How to make links in a TextView clickable?

后端 未结 30 3277

I have the following TextView defined:



        
30条回答
  •  独厮守ぢ
    2020-11-21 23:57

    I use the autolink to "auto underline" the text, but just made an "onClick" that manages it. (I ran into this problem myself)

            
    
    public void twitter (View view)
        {
            try
            {
                Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://twitter.com/onaclovtech"));
                startActivity(browserIntent);
    
            }
            finally
            {
            }
        }
    

    Doesn't require any permissions, as you are passing the intent off to apps that manage those resources, (I.E. browser).

    This was what worked for me. Good luck.

提交回复
热议问题