I have a text with some words which if we click on and move to other activities. I tried to search a lot from internet or stack overflow. Is there any technique to solve this issue?
Thanks and best regards
If it's about specific words inside a bigger piece of text, mark the clickable words as URLSpan
and override the URLSpan
's onClick(View widget)
method to start the new Activity
- by default it will fire off on Intent.ACTION_VIEW
. I'm sure you'll be able to find multiple examples if you do a search here on SO.
If you also want to remove the underline that is inherent to the URLSpan
, have a look at this answer.
simply setOnClickListener on TextView
textView.setOnClickListener(new OnClikListener(){
public void onClick(View v){
//here call your activity
}
});