Android web view got refresh when display toast

197 views Asked by At

Hi I am developing android application in which I am using BroadcastReceiver and one Activity. In my activity I am loading WebView. So when I am displaying toast inside my broadcast receiver that time my WebView got reloaded.

final static BroadcastReceiver onComplete = new BroadcastReceiver() {
    public void onReceive(Context context, Intent intent) {
      showToast(context, message, duration);
}

and inside activity

WebView view = new WebView(this);
    view.setWebViewClient(new WebViewClient());
    view.getSettings().setJavaScriptEnabled(true);
    view.loadUrl(url);

So whenever toast comes up it reloads my webview. Need some help. This issue not coming on all devices. But coming on some of android devices.

public static void showToast(Context context, String message, int duration) {
    Toast.makeText(context, message, duration).show();
}
0

There are 0 answers