Why TextView
Hyperlink is not working.
Using hyperlink as inside the custom dialog box
.
The hyperlink is not appear.
Where i am mistaken. How do solve it. Give me guidance.
XML code is
<TextView
android:id="@+id/google_Link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:padding="10dip"
android:textSize="20dip"
android:linksClickable="true"
android:autoLink="all"
android:textColorLink="#306EFF"
android:text="" />
Android Code is
TextView googleLink = ( TextView ) layout.findViewById( R.id.google_Link );
googleLink.setClickable(true);
googleLink.setMovementMethod(LinkMovementMethod.getInstance());
googleLink.setText( Html.fromHtml( "<a href=`http://www.google.co.in`>Google</a>" ) );
Android Manifest Code is
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
Thank in advance.
Replace only this link,it will work:
TextView textView=(TextView) findViewById(R.id.link);
textView.setClickable(true);
String linkTxt=getResources().getString(R.string.link);
textView.setMovementMethod(LinkMovementMethod.getInstance());
textView.setText(Html.fromHtml( linkTxt));
Add this in strings.xml:
<string name="link"><a href=http://www.google.co.in>Google</a></string>
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