Android - volley multiple requests -
i have 2 requests need execute
onstart(...){ callfirstws(); callsecondws(); }
each function use singleton class format
singletonclass.getinstance(<activity>).addtorequestqueue(<request>);
the singleton class
public final class internetsingleton { private static internetsingleton singleton; private requestqueue requestqueue; private static context context; private internetsingleton(context context) { internetsingleton.context = context; requestqueue = getrequestqueue(); } public static synchronized internetsingleton getinstance(context context) { if (singleton == null) { singleton = new internetsingleton(context); } return singleton; } public requestqueue getrequestqueue() { if (requestqueue == null) { requestqueue = volley.newrequestqueue(context.getapplicationcontext()); } return requestqueue; } public void addtorequestqueue(request request) { getrequestqueue().add(request); } }
when run app, first ws called, second not ideas?
i solved problem.
in response of 2st request tried set data 1st response. sorry bad english
Comments
Post a Comment