Note that there are some explanatory texts on larger screens.

plurals
  1. POError in identifying url by clicking on it
    text
    copied!<p>I have 3 pages, my webview takes me to page 1, in page 1 you can go to page 2 or 3, I'm trying to identify if you go to page 2 or 3 from page 1. I'm trying to perform an action type, Toast or Intent in my WebView by clicking on a link, but in method to make the Toast onLoadResource send me the error "The method Maketext (Context, CharSequence, int) in the type Toast is not applicable for the arguments (Class , String, int)" I can do about it to fix this?</p> <pre><code>public class WebViewTest extends Activity{ WebView site; String webUrl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.coursetest); site = (WebView) findViewById(R.id.wvcurse); site.loadUrl("http://wstest.comuf.com/test/webviewtest.html"); site.getSettings().setJavaScriptEnabled(true); site.getSettings().setLoadWithOverviewMode(true); site.getSettings().setUseWideViewPort(false); site.setWebViewClient(new ViewClient());}} </code></pre> <p>my ViewClient.java class is;</p> <pre><code> public class ViewClient extends WebViewClient { @Override public boolean shouldOverrideUrlLoading(WebView v, String url){ super.shouldOverrideUrlLoading(v, url); v.loadUrl(url); return true; } @Override public void onLoadResource(WebView v, String url){ super.onLoadResource(v, url); if( url.equals("http://www.wstest.comuf.com/test/page_two.html") ){ Toast t=Toast.makeText(WebViewTest.class,"passed", Toast.LENGTH_LONG); t.show(); // Intent i = new Intent("com.mariposatraining.courses.lay_main"); //startActivity(i); here too i have the error "The method startActivity(Intent) is undefined for the type ViewClient" } if( url.equals("http://www.wstest.comuf.com/test/page_three.html") ){ Toast t=Toast.makeText(WebViewTest.class,"failed", Toast.LENGTH_LONG); t.show(); } }} </code></pre> <p>How should I make toast or other activity work here? Really would appreciate your help.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload