The "Params" parameter type is String, which means that MyAsyncTask takes one or more strings as parameters in doInBackground(), for example to use in a query.For example: public class MyAsyncTask extends AsyncTask Specify a data type for each of these parameter types, or use Void if the parameter type will not be used. This parameter is automatically passed to onPostExecute() on the main thread. "Result" specifies the type of parameter that doInBackground() returns.These parameters are then passed to the onProgressUpdate() method on the main thread. "Progress" specifies the type of parameters passed to publishProgress() on the background thread."Params" specifies the type of parameters passed to doInBackground() as an array.In your subclass of AsyncTask, provide the data types for three kinds of parameters: This section describes the parameters and usage of AsyncTask, then shows a complete example. To use the AsyncTask class, define a subclass of AsyncTask that overrides the doInBackground(Params.) method (and usually the onPostExecute(Result) method as well). Below is a diagram of their calling order. The result of the background computation is passed to this method as a parameter.įor complete details on these methods, see the AsyncTask reference.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |