How to start new activity by clicking Link in TextView
I have ViewActivity with TextView in wich i set Spanned Text from resource
txt file.
ViewActivity:
Spanned textSP = android.text.Html.fromHtml(text);
tvtv = (TextView)findViewById(R.id.tvtv);
tvtv.setText(textSP);
Linkify.addLinks(tvtv, Linkify.WEB_URLS);
I create link with some ID information as it is written in this article
handle textview link click in my android app. It is necessary that by
clicking on the link, download SecondAcitvity (with other TextView) of my
application (not the browser).
SecondActivity:
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.statya);
//ïûòàåìñÿ ïåðåéòè ñî ññûëêè
Uri data = getIntent().getData();
String data2 = data.getLastPathSegment();
TextView tvStatya = (TextView)findViewById(R.id.tvStatya);
tvStatya.setText(data2);
}
}
No comments:
Post a Comment