Link the TextView without using webview

Java
TextView link;
link = (TextView) findViewById(R.id.link);
link.setMovementMethod(LinkMovementMethod.getInstance());

Strings.xml

<string name="link_google"><u><a href="http://google.co.in">Go to Google</a></u></string>

mainActivity.xml

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#80BFFF"
        android:text="@string/link_google"
        android:id="@+id/link"
        android:layout_gravity="center_vertical"
        />


Comments

Popular posts from this blog

Clear the app data programmatically in android

convert an integer to a string in java

Print the large string values in android log cat.