How to lock back button
<p>I want to lock back button while my data process.
I use AsyncTask to process data as below:</p>

<pre><code>class Process extends AsyncTask&lt;String, String, String&gt; {
@Override
protected void onPreExecute() {
super.onPreExecute();
progDailog = new ProgressDialog(ShareFolderActivity.this.getParent());
progDailog.setMessage("Loading...");
progDailog.setIndeterminate(false);
progDailog.setMax(100);
progDailog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progDailog.setCancelable(true);
progDailog.show();
lock = true;
}
@Override
protected String doInBackground(String... aurl) {
//process
return null;
}
@Override
protected void onPostExecute(String unused) {
super.onPostExecute(unused);
PostLoad();
progDailog.dismiss();
lock = false;
}
}
</code></pre>

<p>And below onBackPressed():</p>

<pre><code>@Override
public void onBackPressed() {
if(!lock) {
//back action
}
}
</code></pre>

<p>When at doInBackground back button be pressed, the back action not do, but the progDailog dismiss.
How can I modify to avoid it dismiss?</p>
