HI Am working for the application using tabs through entire app.In that one particular tab am integrated facebook and twitter.its After clicking facebook button it shows the login screen of facebook and login success also working fine but when the login completed i want to redirect to another activity for that i used the following code in 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);
it is showing the exception at the following line
.startActivity("Items", new Intent(Social.this,MainActivity.class)
and my logcat error is follows:
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
I have googled and did not get any solution please give the solution
Thanks in advance..
try as using runOnUiThread :