错误日志
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@427b7270 is not valid; is your activity running? at android.view.ViewRootImpl.setView(ViewRootImpl.java:653) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:326) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:224) at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:149) at android.view.Window$LocalWindowManager.addView(Window.java:558) at android.app.Dialog.show(Dialog.java:316)错误原因
java.lang.IllegalArgumentException: View not attached to window manager at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:383) at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:285) at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:104) at android.app.Dialog.dismissDialog(Dialog.java:332) at android.app.Dialog.dismiss(Dialog.java:315)
@Override public void onDestroy() { super.onDestroy(); dialog=null; }
java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.ContactsProvider2 uri content://com.android.contacts/data/phones from pid=27697, uid=10194 requires android.permission.READ_CONTACTS, or grantUriPermission() at android.os.Parcel.readException(Parcel.java:1465) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137) at android.content.ContentProviderProxy.query(ContentProviderNative.java:413) at android.content.ContentResolver.query(ContentResolver.java:470) at android.content.ContentResolver.query(ContentResolver.java:413)
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.DIAL dat=tel:xxxxxxxxxxxx } at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424) at android.app.Activity.startActivityForResult(Activity.java:3438) at android.app.Activity.startActivityForResult(Activity.java:3399)
android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:5281) at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:943) at android.view.View.requestLayout(View.java:15614) at android.view.View.requestLayout(View.java:15614)
Looper.prepare(); Toast.makeText(aActivity.this,"test",Toast.LENGTH_SHORT).show(); Looper.loop();
private final Handler msgHandler = new Handler(){ public void handleMessage(Message msg) { switch (msg.arg1) { case R.string.msg_not_network: Toast.makeText(getApplicationContext(), getResources().getString(R.string.msg_not_network), Toast.LENGTH_SHORT).show(); break; default: break; } } };
Message msg = msgHandler.obtainMessage(); msg.arg1 = R.string.msg_not_network; msgHandler.sendMessage(msg);
原文地址:http://blog.csdn.net/growth58/article/details/43449249