嗨,我正在使用整个应用程序中的选项卡为应用程序工作。在该特定选项卡中集成了 facebook 和 twitter.its 单击 facebook 按钮后,它显示 facebook 的登录屏幕和登录成功也可以正常工作,但是登录完成后我想重定向到另一个活动,我在 onComplete() 中使用了以下代码
View view = Socialtab.group.getLocalActivityManager()
.startActivity("Items", new Intent(Social.this,MainActivity.class)
.putExtra("name", name)
.putExtra("email", email)
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
.getDecorView();
Socialtab.group.replaceView(view);
它在以下行显示异常
.startActivity("Items", new Intent(Social.this,MainActivity.class)
我的logcat错误如下:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.karmakexpo/com.karmakexpo.MainActivity}: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1618)
at android.app.ActivityThread.startActivityNow(ActivityThread.java:1524)
at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
at com.karmakexpo.Social.jsonParsing(Social.java:353)
at com.karmakexpo.Social$SampleRequestListener.onComplete(Social.java:258)
at com.karmakexpo.facebook.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:238)
Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.<init>(Handler.java:121)
at android.app.Activity.<init>(Activity.java:698)
at com.karmakexpo.MainActivity.<init>(MainActivity.java:56)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1409) at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1610)
... 6 more
我用谷歌搜索并没有得到任何解决方案请提供解决方案提前谢谢..