views:

33

answers:

1

Hi all,

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;
    }
+2  A: 

You could use progressBar.setCancelable(false);

From the docs:

setCancelable(boolean flag)

Sets whether this dialog is cancelable with the BACK key.

Francesco