0

When i press the home button to push my application to the background, and resume it afterwards, sometimes the app UI elements do not have focus. The entire screen is sort of greyed out (brightness is decreased) and none of the on screen buttons, can be clicked. What's more, event the hardware buttons except volume, power and home do not function. The only solution is to force stop the app and start again. This issue is not reproducible, and happens only rarely on random occasions. Has anyone else seen this issue in their applications ?

EDIT ::::::::::

I found the real issue. This is more reproducible: I hit a web service to download data in an AsyncTAsk, and show a ProgressDialog. While the dialog is showing, if the user presses home button., the app is sent to background. Meanwhile, the download is complete, and the dialog is dismissed. Now when the user goes back to the application, the activity does not receive focus back, in essence, it does not receive any more touch events.

Added code of the async task here:

class GetStoresTask extends AsyncTask<String, Void, List<String>> {
    ProgressDialog pd;

    protected void onPreExecute() {
        super.onPreExecute();
        pd = ProgressDialog.show(DisplayStoresActivity.this,
                getResources().getString(R.string.pleaseWait),
                getResources().getString(R.string.dialogFindingStores),
                true, true);
        pd.setOnCancelListener(new OnCancelListener() {

            public void onCancel(DialogInterface dialog) {
                // TODO Auto-generated method stub
                GetStoresTask.this.cancel(true);
            }
        });
    }

    protected List<Message> doInBackground(String... params) {
        // carried out my download here
                          return downloadStoresList();
    }

    protected void onPostExecute(List<String> result) {
        // TODO Auto-generated method stub
        pd.dismiss();
                          adapter.notifyDataSetChanged();
        super.onPostExecute(storesList);
    }

It seems when the app is in background, and the dialog is dismissed, the focus is not transferred to the dialog to my Activity. Has anyone faced similar problems, or have any solution to this ?

rDroid
  • 4,875
  • 3
  • 25
  • 30

1 Answers1

0

not a usual issue . it happens when you do some heavy/complex operations on resuming screen/app which stuck the UI. so analyze various implementations .

Shailendra Singh Rajawat
  • 8,172
  • 3
  • 35
  • 40