android - ShowCase View with fragments -


i'm trying intro tutorial android aplication uses view pager fragments pager adapter , things don't work fragments.

i'm using library: https://github.com/amlcurran/showcaseview

    t1 = new viewtarget(r.id.btngenerate, getactivity());     t2 = new viewtarget(r.id.cbfavorito, getactivity());     t3 = new viewtarget(r.id.txtresult, getactivity());       view.post(new runnable() {         @override         public void run() {                 if(isadded()) {                 showcaseview = new showcaseview.builder(getactivity())                         .settarget(target.none)                         .setcontenttitle("tutorial")                         .setcontenttext("aprenda como usar o aplicativo")                         .build();                 showcaseview.setbuttontext("next");                 showcaseview.setonclicklistener(new view.onclicklistener() {                     @override                     public void onclick(view v) {                         switch (contador) {                             case 0:                                 showcaseview.setshowcase(t1, true);                                 showcaseview.setcontenttitle("teste");                                 showcaseview.setcontenttext("teste");                                 break;                             case 1:                                 showcaseview.setshowcase(t2, true);                                 showcaseview.setcontenttitle("gerar um nome");                                 showcaseview.setcontenttext("teste");                                 break;                             case 2:                                 showcaseview.setshowcase(t3, true);                                 showcaseview.setcontenttitle("adicionar aos favoritos");                                 showcaseview.setcontenttext("teste");                                 showcaseview.setbuttontext("fechar");                                 break;                             case 3:                                 showcaseview.hide();                                 break;                         }                         contador++;                     }                 });             }         }     }); 

in code above i'm trying focus different buttons when click in button next of showcase view, but, when clicked tutorial closes, nothing happens, no erros, closes.

you dont have take event listner button, try this:

  public void run() {                             try {                                 showcase();                             } catch (exception e) {                                 e.printstacktrace();                             } 

and showcase:

 showcaseview = new showcaseview.builder(getactivity())                 .settarget(new viewtarget(r.id.tool_bar, getactivity()))                 .setcontenttitle(getstring(r.string.title_list_os))                 .setcontenttext(getstring(r.string.dica_atualizar_os))                 .setonclicklistener(this)                 .setstyle(r.style.customshowcasetheme)                 .build(); 

your activity needs implements view.onclicklistener

sorry english.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -