I use the following link for how to get back to android activity page from webview
the solution works perfect to dispaly the Toast message only..
but here im facing issue is when try to start the new activity after the toast message im getting VM aborting error message.
public class JavaScriptInterface{
Context mContext;
/** Instantiate the interface and set the context */
JavaScriptInterface(Context c) {
mContext = c;
}
/** Show a toast from the web page */
@JavascriptInterface
public void showToast(String toast) {
Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
menuScreenActivity menu=new menuScreenActivity ();
menu.logout();//here i try to call the logut method
}
}
in the menuScreenActivity Activity i created method called logout
Method in the menuScreenActivity
public void logout(){
Intent myIntent= new Intent(menuScreenActivity.this,LoginActivity.class);
startActivity(myIntent);
}
My Log cat says
JNI WARNING: jarray 0x405a2478 points to non-array object (Ljava/lang/String;)
"WebViewCoreThread" prio=5 tid=9 NATIVE
| group="main" sCount=0 dsCount=0 obj=0x4058d718 self=0x1fecb0
| sysTid=746 nice=0 sched=0/0 cgrp=default handle=5148120
| schedstat=( 23519331303 11309830622 1216 )
at android.webkit.WebViewCore.nativeTouchUp(Native Method)
at android.webkit.WebViewCore.nativeTouchUp(Native Method)
at android.webkit.WebViewCore.access$3300(WebViewCore.java:53)
at android.webkit.WebViewCore$EventHub$1.handleMessage(WebViewCore.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:629)
at java.lang.Thread.run(Thread.java:1019)
VM aborting
Please let me know how to solve this issue?
menuScreenActivity menu=new menuScreenActivity ();is almost certainly wrong. You should never create andActivitywithnew. It looks like you were doing that just to get aContextto pass toIntent. You already have aContextyou save a reference to, so you can use that to launch the intent, assuming you passed an Activity context.