How can I create a button whose text look like a hyperlink text.
Easy, you just have to create an TextView and enable the property autoLink="all", and you don't need to pass any HTML, only the url inside a text or just the url.
Example:
<TextView
android:id="@+id/tvLink"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="Please click www.google.com.br and search for anything!"
android:autoLink="all"/>
in your string.xml add:
<string name="Test"><a href="http://www.bla.com">Test</a></string>
in your TextView add the attribute:
android:autoLink="all"
I did this way in my Project
Uri uri = Uri.parse("http://www.example.com");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With