Note that there are some explanatory texts on larger screens.

plurals
  1. POApp crashes when rotating phone due to the Window Manager
    text
    copied!<p>My andorid app works fine in most cases but sometimes crashes when the phone rotates, i get the error log below which I don't understand. Can anyone explain why this happens?</p> <p>Here is the error log :</p> <pre><code>02-22 14:44:52.175: D/AndroidRuntime(26784): Shutting down VM 02-22 14:44:52.175: W/dalvikvm(26784): threadid=1: thread exiting with uncaught exception (group=0x40e81300) 02-22 14:44:52.183: E/AndroidRuntime(26784): FATAL EXCEPTION: main 02-22 14:44:52.183: E/AndroidRuntime(26784): java.lang.IllegalArgumentException: View not attached to window manager 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:653) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:349) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.app.Dialog.dismissDialog(Dialog.java:319) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.app.Dialog.dismiss(Dialog.java:302) 02-22 14:44:52.183: E/AndroidRuntime(26784): at com.example.chartviewer.JsonActivity$getChartItems.onPostExecute(JsonActivity.java:267) 02-22 14:44:52.183: E/AndroidRuntime(26784): at com.example.chartviewer.JsonActivity$getChartItems.onPostExecute(JsonActivity.java:1) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.os.AsyncTask.finish(AsyncTask.java:631) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.os.AsyncTask.access$600(AsyncTask.java:177) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.os.Handler.dispatchMessage(Handler.java:99) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.os.Looper.loop(Looper.java:137) 02-22 14:44:52.183: E/AndroidRuntime(26784): at android.app.ActivityThread.main(ActivityThread.java:4745) 02-22 14:44:52.183: E/AndroidRuntime(26784): at java.lang.reflect.Method.invokeNative(Native Method) 02-22 14:44:52.183: E/AndroidRuntime(26784): at java.lang.reflect.Method.invoke(Method.java:511) 02-22 14:44:52.183: E/AndroidRuntime(26784): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 02-22 14:44:52.183: E/AndroidRuntime(26784): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 02-22 14:44:52.183: E/AndroidRuntime(26784): at dalvik.system.NativeStart.main(Native Method) </code></pre> <p><em>Update</em></p> <p>Here is the code for the the onPostExecuteMethod:</p> <p>//Removes the progress dialog when the data has been fetched</p> <pre><code> protected void onPostExecute(String args) { progressDialog.dismiss(); //Shows alert dialog if data is unavailable if(args != null &amp;&amp; args.equals(noData)){ AlertDialog.Builder builder = new AlertDialog.Builder(JsonActivity.this); builder.setIcon(R.drawable.artistlogo); builder.setTitle("Musicmetric Charts"); builder.setMessage(noData); builder.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // finishes the activity and leads back to the list of charts JsonActivity.this.finish(); } }); AlertDialog alert = builder.create(); alert.show(); } } </code></pre>
 

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