Kakey
Kakey

Reputation: 4024

Dialog box issue on android

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);
}

    public void onBackPressed()
    {

        return;
    }

Upvotes: 0

Views: 338

Answers (1)

Francesco Laurita
Francesco Laurita

Reputation: 23552

You could use progressBar.setCancelable(false);

From the docs:

setCancelable(boolean flag)

Sets whether this dialog is cancelable with the BACK key.

Upvotes: 5

Related Questions