Extending AsyncTask<Void, Void, Void>
<p>In my android app I am performing some operations in the <code>doInBackground</code> by extending <code>AsyncTask&lt;Void, Void, Void&gt;</code> class. (I have no use in performing any UI in this class) </p>

<ol>
<li>Is this proper use of AsyncTask ?  </li>
<li>If so can I extend AsyncTask instead ?</li>
<li>What is the difference between extending <code>AsyncTask</code> and <code>AsyncTask&lt;Void, Void, Void&gt;</code></li>
</ol>

<p>Code example:</p>

<pre><code>public class MessagePooling extends AsyncTask&lt;Void, Void, Void&gt;
{        
    @Override
    protected Void doInBackground(Void... params) 
    {
        while (!isCancelled()) 
        {           
           //Getting data from server            
            SystemClock.sleep(1000);
        }
        return null;
    }
}
</code></pre>

<p>Or: </p>

<pre><code>public class MessagePooling extends AsyncTask
{
    @Override
    protected Object doInBackground(Object... params) 
    {
        while (!isCancelled()) 
        {           
           //Getting data from server            
            SystemClock.sleep(1000);
        }
        return null;    
    }
}
</code></pre>

<p>Thanks</p>
