0

i want to make my text view clickable in a way that when the user taps it it will send him to our website/url. Can someone show me how to do this? Thanks

user1223679
  • 101
  • 1
  • 2
  • 9
  • possible duplicate of [How do I make links in a TextView clickable?](http://stackoverflow.com/questions/2734270/how-do-i-make-links-in-a-textview-clickable) – slayton Mar 12 '12 at 19:28

3 Answers3

0

Well are you looking for the user to enter their URL of choice and then a corresponding "go" button will take them to the URL? If so, I would implement a TextView in your XML file. After that, make sure you implement the TextView you created within the apps java file.

Eli
  • 262
  • 5
  • 15
0

First of all you need to implement the OnClickListener and put the listener to the TextView

tvExample.setOnClickListener(this);

In the OnClick method you need to launch an Intent with the Url from the webpage.

String url = "http://example.com";  
Intent i = new Intent(Intent.ACTION_VIEW);  
i.setData(Uri.parse(url));  
startActivity(i);  
Ceetn
  • 2,728
  • 2
  • 25
  • 28
0

You can read more about this here[enter link description here. You will find information on that website and example aswell.

Good luck, Arkde

Aurelian Cotuna
  • 3,076
  • 3
  • 29
  • 49