android Programming Glossary: ontaskcomplete
Common class for AsyncTask in Android? http://stackoverflow.com/questions/3291490/common-class-for-asynctask-in-android use a callback interface. Here is a simple example of this concept interface AsyncTaskCompleteListener T public void onTaskComplete T result then in your B class class B implements AsyncTaskCompleteListener String public void onTaskComplete String result.. void onTaskComplete T result then in your B class class B implements AsyncTaskCompleteListener String public void onTaskComplete String result do whatever you need public void launchTask String url A a new A context this a.execute url you should now.. String result finalResult result progressDialog.dismiss System.out.println on Post execute called callback.onTaskComplete result This way you don't need to wait explicitely for your task to complete instead your main code which is probably the..
Android REST client, Sample? http://stackoverflow.com/questions/8267928/android-rest-client-sample restUrl Utils.constructRestUrlForProfile userName new GetTask restUrl new RestTaskCallback @Override public void onTaskComplete String response Profile profile Utils.parseResponseAsProfile response callback.onDataReceived profile .execute Submit.. requestBody Utils.serializeProfileAsString profile new PostTask restUrl requestBody new RestTaskCallback public void onTaskComplete String response callback.onPostSuccess .execute Class definition for a callback to be invoked when the response data.. Return the HTTP Response body here. return response @Override protected void onPostExecute String result mCallback.onTaskComplete result super.onPostExecute result An AsyncTask implementation for performing POSTs on the Hypothetical REST APIs. public..
|