HOW TO USE ASYNCTASK IN ANDROID AND HOW TO CALL ASYNCTYPE CLASS.

Monaj Singh

Total Post:41

Points:287
Posted by  Monaj Singh
 800  View(s)
Ratings:
Rate this:
How to use asynctask in android and how to call asynctype class
  1. sandy taylor

    Post:46

    Points:324
    Re: How to use asynctask in android and how to call asynctype class.

    Create class and extends with AsyncTask

         private class MyAsyncData extends AsyncTask<String, Void, String> {

            @Override

             protected void onPreExecute() {

               // Write your code which run first

               // This code execute first

              // You can show Process dialog.

            }

            @Override

            protected String doInBackground(String... urls) {

                 // write your code which you perform task in background.

                return null;

             }

             @Override

             protected void onPostExecute(String result) {

                  // write your code which you perform task in after doInBackground()

             }

         }

    Call Async type class

       MyAsyncData task = new MyAsyncData();

       task.execute(new String[] { "Sample" });

      Modified On Feb-20-2015 06:33:49 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!