Open TextView links at another activity, not default browser

后端 未结 5 740
忘掉有多难
忘掉有多难 2020-12-13 04:52

Having the textView with autoLinkMask set to Linkify.ALL, i\'m able to open the links and the browser shows the web-page.

I need to call a

5条回答
  •  别那么骄傲
    2020-12-13 05:38

    Than do this:

            TextView textView=(TextView) findViewById(R.id.link);
            textView.setOnClickListener(new OnClickListener() {
    
                public void onClick(View v) {
                    Intent intent=new Intent(YourActivityName.this,WebActivity.class);
                    startActivity(intent);
                }
            });
    

    onCreate of WebActivity Class:

    WebView webView=(WebView) findViewById(R.id.web);
    webView.loadUrl("http://www.google.co.in");
    

    Add this under textview in xml:

    android:clickable="true"
    

提交回复
热议问题