开发者

Dialog box issue on android

开发者 https://www.devze.com 2023-01-21 00:39 出处:网络
I am loading the data using http connection,when it does i am using progress dialog box. The problem is when i press the hardware back button , dialog box is removed before loading all the data,but da

I am loading the data using http connection,when it does i am using progress dialog box. The problem is when i press the hardware back button , dialog box is removed before loading all the data,but data is showed successfully,

the code for back button is i have used is,

   public boolean onKeyDown(int keyCode, KeyEvent event) 
  {
    if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) 
    {



        return true;
    }

    return super.onKeyDown(keyCode, event);
}开发者_Go百科

    public void onBackPressed()
    {

        return;
    }


You could use progressBar.setCancelable(false);

From the docs:

setCancelable(boolean flag)

Sets whether this dialog is cancelable with the BACK key.

0

精彩评论

暂无评论...
验证码 换一张
取 消