Using Javascript bridge in android
Your methods inside WebAppInterface
class are missing the @JavascriptInterface
annotation.
Your WebAppInterface
class should be like this,
public class WebAppInterface {
Context mContext;
WebAppInterface(Context c) {
mContext = c;
}
@JavascriptInterface
public void showToast(String toast) {
}
@JavascriptInterface
public void showDialog(String dialogMsg){
}
@JavascriptInterface
public void moveToNextScreen(){
}
}
Edit
Don't forget to limit your app to API17+ when loading web content into the WebView, otherwise your App will be vulnerable to attacks. Read @Robert's comment below.