Friday 15 May 2015

Android, AsyncTask, onProgressUpdate and onPostExecute not being called -


After doInBackground itemprop = "text">

it is not called, onPostExecute is. And if I try to publish any progress, then onProgressUpdate is not called.

I have created an asyncTask that does nothing in the background but logs a text and still not called both methods.

This is my code

  Public class MyAsyncTask asyncTask and lt; Object, integer, zero & gt; {@Override Safe Voice Doin Background (Object ... Parameter) {Log D. ("MySync Task", "Do Inbachground"); PublishProgress (1); Return tap; } @Override Secure Zero at postexec (zero result) {log d. ("MySync Task", "On Piece Execute"); Super.onPostExecute (results); } @ Override Preserve Update on Progress Zero (Integer ... Value) {Log D. ("MySync Task", "On Progress Update"); Super.onProgressUpdate (value); }}   

And here's how I call it

  New MyAsyncTask () Execute (); Perform your work on the main / UI thread:  
   

New MyAsyncTask () Execute ("Test");

asynctask:

  public class MyAsyncTask asyncTask and lt; String, integer, string & gt; {Protected void onPreExecute () {Log D. ("MyAsyncTask", "MyAsyncTask Start"); } Protected string doInBackground (string ... parameter) {log d. ("MyAsyncTask", parameter [0] + "in the background."); PublishProgress (parameter [0]); Return tap; } Secure zero on the progress update (integer value ...) {log d. ("MyAsyncTask", "Progress Update -" + Value [0]); } Protected void onPostExecute (string result) {Log.d ("MyAsyncTask", "onPostExecute" + result); }}    

No comments:

Post a Comment