android - I have a method that works in my MainActivity, but the same code does not work in other classes -


i have method calls php page retrieve data mysql. method works fine in mainactivity class, exact same code not work if move code different class. here method:

 public void setroundnumber() {     try{         httpclient = new defaulthttpclient();         httppost = new httppost("http://brad.grublist.net/project/getroundnumber.php");         namevaluepairsroundnumber = new arraylist<namevaluepair>(1);         namevaluepairsroundnumber.add(new basicnamevaluepair("eventdate", globalclass.eventdate));         httppost.setentity(new urlencodedformentity(namevaluepairsroundnumber));         //execute http post request         responsehandler<string> responsehandler = new basicresponsehandler();         final string json = httpclient.execute(httppost, responsehandler);          log.e("response: ", "> " + json);          if (json != null) {             try {                 jsonobject jsonobj = new jsonobject(json);                 if (jsonobj != null) {                     jsonarray roundnumber = jsonobj.getjsonarray("roundnumber");                          jsonobject catobj = (jsonobject) roundnumber.get(0);                     string roundnum = catobj.getstring("roundnumber");                     globalclass.roundnumber = roundnum;                 }             } catch (jsonexception e) {                 e.printstacktrace();             }         } else {             log.e("json data", "didn't receive data server!");         }     }catch(exception e){         system.out.println("exception : " + e.getmessage());     } } 

is there missing in other classes method work there? have tried making static method in mainactivity , tried accessing in other classes , have had no luck either.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -