[android-developers] Re: exception when create new AlertDialog
Thanks, works perfectly Very thanks I spent hours working on this problem El domingo, 14 de abril de 2013 20:50:18 UTC+2, Jonathan S escribió: > > on new AlertDialog.Builder(getApplication());, replaces getApplication() > to MainActivity.this > > > On Sunday, April 14, 2013 10:55:42 AM UTC-4, Carlos Calvo wrote: >> >> Hello, >> >> I have a ProgressDialog running. Execute method ".dismiss" for destroy >> them. >> >> But when i create a new AlertDialog i take a exception because the >> progessdialog yet still show >> >> *Exception *"Unable to add window -- token null is not for an >> application" >> >> *The code:* >> >>if (pd.isShowing()){ >> pd.dismiss(); >> } >> MainActivity.this.runOnUiThread(new Runnable() { >> >> public void run() { >> >> AlertDialog.Builder builder = new >> AlertDialog.Builder(getApplication()); >> builder.setTitle("Lo sentimos por el Fallo") >> .setMessage("Resolveremos el fallo lo antes posible") >> .setCancelable(false) >> .setIcon(R.drawable.ic_exception) >> .setPositiveButton("Enviar Fallo", >> new DialogInterface.OnClickListener() { >> public void onClick(DialogInterface dialog, int id) { >> //enviar por mail traza exception >> mDamageReport.submit( new Exception() ); >> finish(); >> } >> }) >> .setNegativeButton("Cerrar", >> new DialogInterface.OnClickListener() { >> public void onClick(DialogInterface dialog, >> int id) { >> finish(); >> } >> }); >> >> builder.create().show(); >> >> } >> }); >> > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: exception when create new AlertDialog
on new AlertDialog.Builder(getApplication());, replaces getApplication() to MainActivity.this On Sunday, April 14, 2013 10:55:42 AM UTC-4, Carlos Calvo wrote: > > Hello, > > I have a ProgressDialog running. Execute method ".dismiss" for destroy > them. > > But when i create a new AlertDialog i take a exception because the > progessdialog yet still show > > *Exception *"Unable to add window -- token null is not for an application" > > *The code:* > >if (pd.isShowing()){ > pd.dismiss(); > } > MainActivity.this.runOnUiThread(new Runnable() { > > public void run() { > > AlertDialog.Builder builder = new > AlertDialog.Builder(getApplication()); > builder.setTitle("Lo sentimos por el Fallo") > .setMessage("Resolveremos el fallo lo antes posible") > .setCancelable(false) > .setIcon(R.drawable.ic_exception) > .setPositiveButton("Enviar Fallo", > new DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, int id) { > //enviar por mail traza exception > mDamageReport.submit( new Exception() ); > finish(); > } > }) > .setNegativeButton("Cerrar", > new DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, > int id) { > finish(); > } > }); > > builder.create().show(); > > } > }); > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: exception when create new AlertDialog
LogCat complete 04-14 19:15:42.780: D/dalvikvm(32486): Late-enabling CheckJNI 04-14 19:15:42.928: I/System.out(32486): Sending WAIT chunk 04-14 19:15:42.928: W/ActivityThread(32486): Application aur.sss is waiting for the debugger on port 8100... 04-14 19:15:43.014: I/dalvikvm(32486): Debugger is active 04-14 19:15:43.131: I/System.out(32486): Debugger has connected 04-14 19:15:43.131: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:43.342: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:43.537: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:43.740: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:43.944: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:44.139: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:44.342: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:44.545: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:44.740: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:44.944: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:45.147: I/System.out(32486): waiting for debugger to settle... 04-14 19:15:45.342: I/System.out(32486): debugger has settled (1419) 04-14 19:15:45.787: D/dalvikvm(32486): threadid=1: still suspended after undo (sc=1 dc=1) 04-14 19:15:53.889: W/System.err(32486): java.io.EOFException 04-14 19:15:53.928: W/System.err(32486): at java.io.DataInputStream.readByte(DataInputStream.java:98) 04-14 19:15:53.936: W/System.err(32486): at java.io.ObjectInputStream.nextTC(ObjectInputStream.java:506) 04-14 19:15:53.936: W/System.err(32486): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:778) 04-14 19:15:53.936: W/System.err(32486): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006) 04-14 19:15:53.936: W/System.err(32486): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1963) 04-14 19:15:53.944: W/System.err(32486): at aur.sss.managers.DataManager.ReadToFile(DataManager.java:124) 04-14 19:15:53.944: W/System.err(32486): at aur.sss.managers.UserManager.CheckUser(UserManager.java:53) 04-14 19:15:53.944: W/System.err(32486): at aur.sss.MainActivity.onCreate(MainActivity.java:186) 04-14 19:15:53.944: W/System.err(32486): at android.app.Activity.performCreate(Activity.java:5104) 04-14 19:15:53.951: W/System.err(32486): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 04-14 19:15:53.951: W/System.err(32486): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 04-14 19:15:53.951: W/System.err(32486): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 04-14 19:15:53.951: W/System.err(32486): at android.app.ActivityThread.access$600(ActivityThread.java:141) 04-14 19:15:53.959: W/System.err(32486): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 04-14 19:15:53.959: W/System.err(32486): at android.os.Handler.dispatchMessage(Handler.java:99) 04-14 19:15:53.959: W/System.err(32486): at android.os.Looper.loop(Looper.java:137) 04-14 19:15:53.959: W/System.err(32486): at android.app.ActivityThread.main(ActivityThread.java:5041) 04-14 19:15:53.959: W/System.err(32486): at java.lang.reflect.Method.invokeNative(Native Method) 04-14 19:15:53.959: W/System.err(32486): at java.lang.reflect.Method.invoke(Method.java:511) 04-14 19:15:53.967: W/System.err(32486): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 04-14 19:15:53.967: W/System.err(32486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 04-14 19:15:53.967: W/System.err(32486): at dalvik.system.NativeStart.main(Native Method) 04-14 19:15:54.155: D/dalvikvm(32486): GC_CONCURRENT freed 203K, 3% free 8882K/9116K, paused 16ms+4ms, total 50ms 04-14 19:15:54.506: W/System.err(32486): java.io.EOFException 04-14 19:15:54.506: W/System.err(32486): at java.io.DataInputStream.readByte(DataInputStream.java:98) 04-14 19:15:54.506: W/System.err(32486): at java.io.ObjectInputStream.nextTC(ObjectInputStream.java:506) 04-14 19:15:54.514: W/System.err(32486): at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:778) 04-14 19:15:54.514: W/System.err(32486): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006) 04-14 19:15:54.514: W/System.err(32486): at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1963) 04-14 19:15:54.514: W/System.err(32486): at aur.sss.managers.DataManager.ReadToFile(DataManager.java:124) 04-14 19:15:54.522: W/System.err(32486): at aur.sss.managers.SyncroManager.LoadAllZonas(SyncroManager.java:60) 04-14 19:15:54.522: W/System.err(32486): at aur.sss.MainActivity.onCreate(MainActivity.java:202) 04-14 19:15:54.522: W/System.err(32486): at android.app.Activity.performCreate(Activity.java:5104) 04-14 19:15:54.522: W/System.err(32486): at android.app.Instrumentation.callActivityOnC
[android-developers] Re: exception when create new AlertDialog
Where is the rest of it, you have truncated it too soon. On Sunday, April 14, 2013 5:10:47 PM UTC+1, Carlos Calvo wrote: > > The logcat > > 04-14 18:06:42.043: E/AndroidRuntime(26483): FATAL EXCEPTION: main > 04-14 18:06:42.043: E/AndroidRuntime(26483): > android.view.WindowManager$BadTokenException: Unable to add window -- token > null is not for an application > 04-14 18:06:42.043: E/AndroidRuntime(26483): at > android.view.ViewRootImpl.setView(ViewRootImpl.java:571) > 04-14 18:06:42.043: E/AndroidRuntime(26483): at > android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246) > 04-14 18:06:42.043: E/AndroidRuntime(26483): at > android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) > > thx > > > El domingo, 14 de abril de 2013 17:18:00 UTC+2, RichardC escribió: >> >> Show us the Logcat >> >> On Sunday, April 14, 2013 3:55:42 PM UTC+1, Carlos Calvo wrote: >>> >>> Hello, >>> >>> I have a ProgressDialog running. Execute method ".dismiss" for destroy >>> them. >>> >>> But when i create a new AlertDialog i take a exception because the >>> progessdialog yet still show >>> >>> *Exception *"Unable to add window -- token null is not for an >>> application" >>> >>> *The code:* >>> >>>if (pd.isShowing()){ >>> pd.dismiss(); >>> } >>> MainActivity.this.runOnUiThread(new Runnable() { >>> >>> public void run() { >>> >>> AlertDialog.Builder builder = new >>> AlertDialog.Builder(getApplication()); >>> builder.setTitle("Lo sentimos por el Fallo") >>> .setMessage("Resolveremos el fallo lo antes posible") >>> .setCancelable(false) >>> .setIcon(R.drawable.ic_exception) >>> .setPositiveButton("Enviar Fallo", >>> new DialogInterface.OnClickListener() { >>> public void onClick(DialogInterface dialog, int id) { >>> //enviar por mail traza exception >>> mDamageReport.submit( new Exception() ); >>> finish(); >>> } >>> }) >>> .setNegativeButton("Cerrar", >>> new DialogInterface.OnClickListener() { >>> public void onClick(DialogInterface dialog, >>> int id) { >>> finish(); >>> } >>> }); >>> >>> builder.create().show(); >>> >>> } >>> }); >>> >> -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: exception when create new AlertDialog
The logcat 04-14 18:06:42.043: E/AndroidRuntime(26483): FATAL EXCEPTION: main 04-14 18:06:42.043: E/AndroidRuntime(26483): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application 04-14 18:06:42.043: E/AndroidRuntime(26483): at android.view.ViewRootImpl.setView(ViewRootImpl.java:571) 04-14 18:06:42.043: E/AndroidRuntime(26483): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:246) 04-14 18:06:42.043: E/AndroidRuntime(26483): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) thx El domingo, 14 de abril de 2013 17:18:00 UTC+2, RichardC escribió: > > Show us the Logcat > > On Sunday, April 14, 2013 3:55:42 PM UTC+1, Carlos Calvo wrote: >> >> Hello, >> >> I have a ProgressDialog running. Execute method ".dismiss" for destroy >> them. >> >> But when i create a new AlertDialog i take a exception because the >> progessdialog yet still show >> >> *Exception *"Unable to add window -- token null is not for an >> application" >> >> *The code:* >> >>if (pd.isShowing()){ >> pd.dismiss(); >> } >> MainActivity.this.runOnUiThread(new Runnable() { >> >> public void run() { >> >> AlertDialog.Builder builder = new >> AlertDialog.Builder(getApplication()); >> builder.setTitle("Lo sentimos por el Fallo") >> .setMessage("Resolveremos el fallo lo antes posible") >> .setCancelable(false) >> .setIcon(R.drawable.ic_exception) >> .setPositiveButton("Enviar Fallo", >> new DialogInterface.OnClickListener() { >> public void onClick(DialogInterface dialog, int id) { >> //enviar por mail traza exception >> mDamageReport.submit( new Exception() ); >> finish(); >> } >> }) >> .setNegativeButton("Cerrar", >> new DialogInterface.OnClickListener() { >> public void onClick(DialogInterface dialog, >> int id) { >> finish(); >> } >> }); >> >> builder.create().show(); >> >> } >> }); >> > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[android-developers] Re: exception when create new AlertDialog
Show us the Logcat On Sunday, April 14, 2013 3:55:42 PM UTC+1, Carlos Calvo wrote: > > Hello, > > I have a ProgressDialog running. Execute method ".dismiss" for destroy > them. > > But when i create a new AlertDialog i take a exception because the > progessdialog yet still show > > *Exception *"Unable to add window -- token null is not for an application" > > *The code:* > >if (pd.isShowing()){ > pd.dismiss(); > } > MainActivity.this.runOnUiThread(new Runnable() { > > public void run() { > > AlertDialog.Builder builder = new > AlertDialog.Builder(getApplication()); > builder.setTitle("Lo sentimos por el Fallo") > .setMessage("Resolveremos el fallo lo antes posible") > .setCancelable(false) > .setIcon(R.drawable.ic_exception) > .setPositiveButton("Enviar Fallo", > new DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, int id) { > //enviar por mail traza exception > mDamageReport.submit( new Exception() ); > finish(); > } > }) > .setNegativeButton("Cerrar", > new DialogInterface.OnClickListener() { > public void onClick(DialogInterface dialog, > int id) { > finish(); > } > }); > > builder.create().show(); > > } > }); > -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.