java - Android, How do I pass a variable as a pointer to a function? -
java - Android, How do I pass a variable as a pointer to a function? -
how pass variable pointer function? have next code wish refactor
public static httpresponse getjsonentityfromurl(context context, string url) throws clientprotocolexception, ioexception { httpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget(url); httpget.addheader("accept", "application/json"); httpget.addheader("content-type", "application/json; charset=utf-8"); httpresponse response; response = httpclient.execute(httpget); homecoming response; } to this
public static httpresponse getjsonentityfromurl(context context, string url) throws clientprotocolexception, ioexception { httpclient httpclient = new defaulthttpclient(); httpget httpget = new httpget(url); setheaders(httpget); httpresponse response; response = httpclient.execute(httpget); homecoming response; } private static void setheaders(httprequestbase httpget) { httpget.addheader("accept", "application/json"); httpget.addheader("content-type", "application/json; charset=utf-8"); } i'm assuming need pass httpget paramater pointer?
i'm assuming need pass httpget paramater pointer?
no, because java not have pointers.
the code have there seems fine -- passing httpget object setheaders() , calling methods upon it. if having specific problems current syntax, please explain.
java android
Comments
Post a Comment