I have textview
which contains urls
like www.google.com. for this textview
a have also created a onclicklistener.
My problem is when user clickes www.google.com, link is used by an activity
, but after that activity
onclick
event is also created. but i dont want to create onclick
events when user clicks on urls .
Is it possible for texview to disable onclick
events when user clickes on urls like http://www.google.com, market://android.. etc.
EDIT 1: I added details below.
TextView entry = (TextView) v
.findViewById(R.id.textViewEntryText);
entry.setText(Html.fromHtml(String.format("%s",
(CharSequence) displayText)));
entry.setMovementMethod(LinkMovementMethod.getInstance());
after creating textview with links then put another events onclick other texts.
entry.setOnClickListener((new View.OnClickListener() {
// TODO Auto-generated method stub
public void onClick(View v) {
// TODO Auto-generated method stub
}
}
}));
Now when user clicks on url link i dont want to other onclick event works for links .
wow. Android is magic. There is a seperate attribute for that:
android:linksClickable:"false"
You can change it in the code, via :
myTextView.setLinksClickable(false);
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