How to open a Google home page on click on hyperlink text view in android am trying out with following code but on click on the hyperlink it just changing to normal text how to resolve it
Here is the code:
MainActivity.java (in onCreate() )
instruction = (TextView) findViewById(R.id.example);
instruction.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
instruction.setText(Html.fromHtml(getString(R.string.Google_Instructions)));
Linkify.addLinks(instruction, Linkify.ALL);
instruction.setMovementMethod(LinkMovementMethod.getInstance());
}
});
strings.xml
<string name="Google_Instructions">opens <a href="https://www.google.co.in">Google</a> page </string>
layout_test.xml
<TextView
android:id="@+id/example"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10sp"
android:clickable="true"
android:text="@string/Google_Instructions"
android:autoLink="web"
android:textSize="16sp" />