I have the text \"Android is a Software stack\". In this text i want to set the \"stack\" text is clickable. in the sense if you click on t
I would suggest a different approach that I think requires less code and is more "localization-friendly".
Supposing that your destination activity is called "ActivityStack", define in the manifest an intent filter for it with a custom scheme (e.g. "myappscheme") in AndroidManifest.xml:
Define the TextView without any special tag (it is important to NOT use the "android:autoLink" tag, see: https://stackoverflow.com/a/20647011/1699702):
then use a link with custom scheme and host in the text of the TextView as (in String.xml):
Android is a Software stack
and "activate" the link with setMovementMethod() (in onCreate() for activities or onCreateView() for fragments):
TextView stack = findViewById(R.id.stackView);
stack.setMovementMethod(LinkMovementMethod.getInstance());
This will open the stack activity with a tap on the "stack" word.