1

hi guys i have a listView and when you click on each an intent will start intent work is so simple show you the url of item but when i click on item go straight to the browser and show the currect url there this is my Adapter Click Code

urlLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String url =twitch.getUrl();
            Intent intent = new Intent(context,TwitchWebView.class);
            intent.putExtra("url",url);
            context.startActivity(intent);
        }
    });

and this is webview activity code

    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_twitch_web_view);
    wv = (WebView) findViewById(R.id.twitch_web_view);
    Bundle bundle = getIntent().getExtras();
    String url = bundle.getString("url");
    if (url!= null){
        Toast.makeText(this, url, Toast.LENGTH_SHORT).show();
        wv.loadUrl(url);
    }

i want to show me the url on this webView (url about Twitch.tv)

Sadegh
  • 55
  • 7

1 Answers1

1

Try this

 wv.setWebViewClient(new WebViewClient(){
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return super.shouldOverrideUrlLoading(view, url);
            }

            @Override
            public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
                return super.shouldOverrideUrlLoading(view, request);
            }
        });
Pankaj Kant Patel
  • 1,820
  • 15
  • 26