Disable the search button in Android

前端 未结 4 411
眼角桃花
眼角桃花 2021-01-14 05:45

I have a dialog in an Android app that I don\'t want the user to be able to cancel. Using .setCancelable(false) disables the back button, but pressing the sear

4条回答
  •  盖世英雄少女心
    2021-01-14 06:07

    I disable search button by overriding progress dialog. I create unnamed class and override method onSearchRequest() . And this is working for me. I use this:

    progressDialog = new ProgressDialog(Activity.this){
    
                    @Override
                    public boolean onSearchRequested() {
                        return true;
                    }           
    
    
                };
    

    instead code:

    progressDialog = new ProgressDialog(Activity.this);
    

提交回复
热议问题