Calling web service using Async task in android? -


I have my own separate web service class in which I only pass the list of the response method, the URL and the array of data that Required to create Requests and feedback I call this web service in my login activity like this

  JifWebService webServices = new JifWebService (); webServices.Execute (RequestMethod.POST, Jifconstant.LOGIN_URL, blank, logged-in data); LoginResponse = webServices.getResponse (); LoginResponseCode = webServices.getResponseCode ();   

This login data contains an array list containing some data. Now I want to call this web service in the background using the async function. But I can not find it correctly My web service argument is written in a completely different Java file and its work is fine but I want to call my web service methods within async work. Enter the code here code

You can see the code for a non-functional task below And call the web service in doInBackground :

  Import Android App Import android.app.ProgressDialog; Import android.os.asyncTask; Importroid.os.Bundle; Public class increases AsyncExample activity {Private string url = "http://www.google.co.in"; @ Override Protected Zero (Bundle Saved Instantstate) {Super. NET (Saved Instantstate); New AsyncCaller () carry about (); } Private class AsyncCaller AsyncTask is spreading & lt; Zero, zero, zero> {Progress DILOG pdLoading = New Progress DiLoog (asynxemplen.es); @ OverEride Protected Zero at PreExecute () {super.onPreExecute (); // This method will be running on the UI thread pdLoading.setMessage ("Loading ..."); PdLoading.show (); } @ Override protected voice downline background (Zero ... Parameters) {// This method must be run on the background thread so that the UI does not update from here. // Here are your long-running HTTP functions, you do not want to pass the logic and you can use the parent class' variable url here; } @Override Secure Zero on postexec (zero result) {super.onPostExecute (results); // This method will be running on the UI thread pdLoading.dismiss (); }}}   

Done

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -