android - How to change tabs within a if statement from a broadcasted variable? -


hi fellow coders need , out of ideas, tried lot of ideas , none worked me....

i busy emission survey application , trying change tab within if statement, if value being broadcasted 1, go second tab , third automatically... attached snippets, please help, grateful....!

the first image of me sending data first tab (all still working @ moment)

    loadb.setonclicklistener(new onclicklistener() {         @override         public void onclick(view v) {             tabactivity tabs = (tabactivity) getparent();             tabs.gettabhost().setcurrenttab(0);             senddata3();         }         private void senddata3() {             take = "1";             intent dataintent = new intent();             dataintent.setaction("com.example.e3soft.receiver");             dataintent.putextra("taken", take);             sendbroadcast(dataintent);             toast.maketext(getbasecontext(), "working", toast.length_long).show();         }     }); 

without if statement works, please help........!

private void receivedata() {     // todo auto-generated method stub     broadcastreceiver receiver = new broadcastreceiver() {         @override         public void onreceive(context context, intent intent) {             // todo auto-generated method stub             take = intent.getstringextra("taken");          }      };      intentfilter filter = new intentfilter();     filter.addaction("com.example.e3soft.receiver");     registerreceiver(receiver, filter);     changetab(); }  protected void changetab() {     // todo auto-generated method stub     toast.maketext(getapplicationcontext(), take, toast.length_long).show();     try {         if (take.equals("1")) {             populatevariables();             tabactivity tabs = (tabactivity) getparent();             tabs.gettabhost().setcurrenttab(1);             senddata();         }     } catch (exception ex) {         toast.maketext(getapplicationcontext(), "error", toast.length_long)                 .show();     } } 

move code inside onreceive :

intentfilter filter = new intentfilter(); filter.addaction("com.example.e3soft.receiver"); registerreceiver(receiver, filter); changetab(); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -