java - calling multiple methods in oncreate method in android -


i have multiple methods called when activity started. have added methods in oncreate method. problem when activity started methods called or not called. how call methods when activity started.

my code is

protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);       asynchttpclient client = new asynchttpclient();      requestparams params = new requestparams();       client.post("http://localhost/website/getdbrowcount.php",params ,new asynchttpresponsehandler()      {            public void onsuccess(string response)            {               try               {                  log.d("home", "success");                   jsonobject obj = new jsonobject(response);                  log.d("home", obj.tostring());                 system.out.println(obj.get("count"));                        syncdb();                 sync();                 subsync();                 syncfeature();                 syncelec();                 syncconnector();                 synccontrols();                 synckeypad();                 syncmech();                 syncorder();                 syncpower();               }                catch (jsonexception e)                {              // todo auto-generated catch block              e.printstacktrace();              }           }            public void onfailure(int statuscode, throwable error,string content)            {               if(statuscode == 404)               {                 update.settext("the update has been cancelled. please update via settings work"                             + " latest sonetonix product data");                   toast.maketext(getapplicationcontext(), "requested resource not found", toast.length_long).show();                   btn1.setenabled(true);                   btn1.settextcolor(color.parsecolor("#ffffff"));               }               else if(statuscode == 500)               {                 update.settext("the update has been cancelled. please update via settings work"                             + " latest sonetonix product data");                   toast.maketext(getapplicationcontext(), "something went wrong @ server end", toast.length_long).show();                   btn1.setenabled(true);                   btn1.settextcolor(color.parsecolor("#ffffff"));               }               else               {                 update.settext("the update has been cancelled. please update via settings work"                             + " latest sonetonix product data");                   toast.maketext(getapplicationcontext(), "unexpected error occcured! [most common error: device might not connected internet]", toast.length_long).show();                   btn1.setenabled(true);                   btn1.settextcolor(color.parsecolor("#ffffff"));               }               log.d("home", "failure");           }      });        } 

in code when onsuccess methods has called syncdb(),sync() called , rest not called . change should make in code resolve issue.

please help

it because in sync() method or possibly @ start of subsync() method program throwing error. because of try/catch block, allowing program continue.

check method error , fix that.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -