uri - How to start new activity by clicking Link in TextView -


i have viewactivity textview in wich set spanned text 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 id information written in article handle textview link click in android app. necessary clicking on link, download secondacitvity (with other textview) of application (not 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); } 

}

put onclick in xml this

  <textview     android:id="@+id/name"      android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:onclick="clickfunction"/> 

then in java

public void clickfunction(view v) {     intent intent = new intent(this, nextactivity.class);     startactivity(intent); } 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -