fragment - Clickable Notification text in android -


i have basic knowledge of android development , i'm curious know if can make specific keyword clickable in android notification instead of clicking anywhere on notification area ?
purpose show different data depending upon click.

e.g. you have purchased iphone5 , ipad mini.
want make iphone5 , 'ipad mini' clickable can show different informations depending upon user click.
i'm trying use clickablespan class i'm still not able perform desired action.

spannable brings lots of possibility textview, includes displaying various appearance of text , onclick callbak.

the normal way make textview clickable use view.setonclicklistener. sets callback listener whole view. if want add callback substring of text?

http://0xwalkingice.blogspot.in/2012/04/android-clickable-span-in-textview.html

you can use clickablespan descried in post

sample code:

textview mytextview = new textview(this); string mystring = "some text [clickable]"; int i1 = mystring.indexof("["); int i2 = mystring.indexof("]"); mytextview.setmovementmethod(linkmovementmethod.getinstance()); mytextview.settext(mystring, buffertype.spannable); spannable myspannable = (spannable)mytextview.gettext(); clickablespan myclickablespan = new clickablespan() {  @override  public void onclick(view widget) { /* */ } }; myspannable.setspan(myclickablespan, i1, i2 + 1, spannable.span_exclusive_exclusive); 

reference


Comments