Fix misuse of AsyncTask (#8799)

This commit is contained in:
Linjie Pan 2019-09-19 06:37:06 +08:00 committed by sfan5
parent 4271889ef8
commit 6a7f5c0985

@ -54,6 +54,14 @@ public class MinetestAssetCopy extends Activity {
makeFullScreen(); makeFullScreen();
} }
@Override
protected void onDestroy() {
super.onDestroy();
if (m_AssetCopy != null) {
m_AssetCopy.cancel(true);
}
}
public void makeFullScreen() { public void makeFullScreen() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
this.getWindow().getDecorView().setSystemUiVisibility( this.getWindow().getDecorView().setSystemUiVisibility(
@ -77,7 +85,7 @@ public class MinetestAssetCopy extends Activity {
return this; return this;
} }
private class copyAssetTask extends AsyncTask<String, Integer, String> { private static class copyAssetTask extends AsyncTask<String, Integer, String> {
boolean m_copy_started = false; boolean m_copy_started = false;
String m_Foldername = "media"; String m_Foldername = "media";
Vector<String> m_foldernames; Vector<String> m_foldernames;