我希望这项任务只是eseguite的时间。当我在此活动中返回时没有eseguite
public void onStart() {
super.onStart();
if (mMovies.le) {
TaskClass nuovo = new TaskClass();
nuovo.execute("http://api.themoviedb.org/3/discover/movie?sort_by=popularity.desc&");
Log.v("prova", "inizio");
}
}
答案 0 :(得分:0)
你必须使用这样的SharedPreferences
:
final String PREFS_NAME = "MyPrefsFile";
SharedPreferences firstPref = getSharedPreferences(PREFS_NAME, 0);
if (firstPref.getBoolean("First_Time", true)) {
//Do first operation
if (mMovies.le) {
TaskClass nuovo = new TaskClass();
nuovo.execute("http://api.themoviedb.org/3/discover/movie?sort_by=popularity.desc&");
Log.v("prova", "inizio");
}
firstPref.edit().putBoolean("First_Time", false).commit();
}
您的活动的onCreate()
方法