Last active
August 29, 2015 14:21
-
-
Save mryp/ec7ffd15a2a3b41afe97 to your computer and use it in GitHub Desktop.
非同期処理(AsyncTask)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.AsyncTask; | |
public class SampleAsyncTask extends AsyncTask<String, Integer, Integer> { | |
/** | |
* 前処理 | |
*/ | |
@Override | |
protected void onPreExecute() { | |
//開始前の初期化処理等を行う | |
} | |
/** | |
* 処理開始(非同期) | |
*/ | |
@Override | |
protected Integer doInBackground(String... text) { | |
//非同期の実処理を行う | |
return 0; | |
} | |
/** | |
* 更新処理 | |
*/ | |
@Override | |
protected void onProgressUpdate(Integer... progress) { | |
//現在の処理状況を反映する(プログレスダイアログなど) | |
} | |
/** | |
* 完了処理 | |
*/ | |
@Override | |
protected void onPostExecute(Integer result) { | |
//後処理を行う | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//処理開始 | |
SampleAsyncTask task = new SntpTimeUpdateAsyncTask(); | |
task.execute("text[0]の文字列"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment