Android: don't start a new thread, reuse the current one

This commit is contained in:
Mahmood(Thunder07) 2017-06-11 04:53:54 +01:00
parent 39fe7a59a8
commit 5fd03f5075

View File

@ -55,7 +55,6 @@ public class GamesDbAPI extends AsyncTask<File, Integer, Boolean> {
private static final String games_url = "http://thegamesdb.net/api/GetGamesList.php?platform=sony+playstation+2&name=";
private static final String games_url_id = "http://thegamesdb.net/api/GetGame.php?platform=sony+playstation+2&id=";
private static final String games_list = "http://thegamesdb.net/api/GetPlatformGames.php?platform=11";
private boolean _terminate = true;
public GamesDbAPI(Context mContext, String gameID, String serial, GameInfoStruct gameInfoStruct, int pos) {
this.elastic = false;
@ -117,8 +116,8 @@ public class GamesDbAPI extends AsyncTask<File, Integer, Boolean> {
if (elastic) {
this.gameID = remoteID;
_terminate = false;
return false;
this.elastic = false;
return doInBackground(gameFile);
} else {
final String title = getValue(root, "GameTitle");
final String overview = getValue(root, "Overview");
@ -187,12 +186,6 @@ public class GamesDbAPI extends AsyncTask<File, Integer, Boolean> {
}
}
}
else if(!_terminate)
{
GamesDbAPI gameDatabase = new GamesDbAPI(mContext, gameID, serial, this.gameInfoStruct, pos);
gameDatabase.setView(viewHolder);
gameDatabase.execute(gameFile);
}
}
public static boolean isNetworkAvailable(Context mContext) {