Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Activity does not receive focus when dialog is dismissed in background
    primarykey
    data
    text
    <p>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 <strong>except</strong> volume, power and home do not function. The only solution is to force stop the app and start again. <strong>This issue is not reproducible</strong>, and happens only rarely on random occasions. Has anyone else seen this issue in their applications ?</p> <p>EDIT ::::::::::</p> <p>I found the real issue. This is more reproducible: I hit a web service to download data in an <code>AsyncTAsk,</code> and show a <code>ProgressDialog</code>. 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 <code>activity</code> does not receive focus back, in essence, it <strong>does not receive any more touch events</strong>.</p> <p>Added code of the async task here:</p> <pre><code>class GetStoresTask extends AsyncTask&lt;String, Void, List&lt;String&gt;&gt; { 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&lt;Message&gt; doInBackground(String... params) { // carried out my download here return downloadStoresList(); } protected void onPostExecute(List&lt;String&gt; result) { // TODO Auto-generated method stub pd.dismiss(); adapter.notifyDataSetChanged(); super.onPostExecute(storesList); } </code></pre> <p>It seems when the app is in background, and the dialog is dismissed, the focus is not transferred to the dialog to my <code>Activity</code>. Has anyone faced similar problems, or have any solution to this ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload