Proper use of AsyncTask
<p>I have a code like this:</p>

<p>In a Button Click I wrote this Code:</p>

<pre><code>new Loadiing().execute();
</code></pre>

<p>It takes to the AsyncTask class That I created, My class Looks Like:</p>

<pre><code>public class Loadiing extends AsyncTask&lt;Void,Void,Void&gt;{

        ProgressDialog d= new ProgressDialog(Main.this);
        @Override
        protected void onPreExecute() {
            // TODO Auto-generated method stub


            ProgressDialog.show(Main.this, "", "Loading");


        }



        @Override
        protected Void doInBackground(Void... params) {
            // TODO Auto-generated method stub
            **A method which returns some data in a arrayadapter and sets it;**
            return null;
        }


        @Override
        protected void onPostExecute(Void result) {
            // TODO Auto-generated method stub
            d.dismiss();

        }


    }
</code></pre>

<p>but it is just starting an alert dialog, nothing is done in the background and also the dialog is not being dismissed, what to do?</p>
