MainActivity is not enclosing class
<p>How to fix this problem?</p>

<blockquote>
  <p>MainActivity.this is not an enclosing class.</p>
</blockquote>

<p>Thank you</p>

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

protected void onPreExecute() {
    super.onPreExecute();
    ProgressDialog pd= new ProgressDialog(MainActivity.this); //error is here
    pd.setMessage("Wait image uploading!");
    pd.show();
}
}
</code></pre>