Reputation: 1769
I want to set hyperlink with textview in android so anyone can help me on it. My code is given below.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Authentication failed. Please visit www.google.com"
/>
Upvotes: 2
Views: 77
Reputation: 2510
Try this. Add ID field in the xml and then do so.
TextView textView =(TextView)findViewById(R.id.textView);
textView.setClickable(true);
textView.setMovementMethod(LinkMovementMethod.getInstance());
String text = "Authentication Failed . Please visit <a href='http://.www.google.com'> Google </a>";
textView.setText(Html.fromHtml(text));
Upvotes: 1