タグ

ブックマーク / wikiwiki.jp (2)

  • AsyncTaskでバックグラウンド処理を行う - Android Wiki*

    AsyncTaskのサブクラスでは、実行時引数(Param)、進捗単位(Progress)、処理結果(Result)で扱う型を指定する必要があります。 AddressRequestTaskの場合は、実行時引数(String)、進捗単位(Integer)、処理結果(Address)を扱います。 public class AddressRequestTask extends AsyncTask<String, Integer, Address> doInBackground()を実装し、必要に応じてonPreExecute()やonPostExecute()を実装します。 @Override protected void onPreExecute() { // …① mResultText.setText(null); mProgressDialog = new ProgressDialog(

    AsyncTaskでバックグラウンド処理を行う - Android Wiki*
  • Intentによるサービス起動 - Android Wiki*

    サンプルとして、起動後にカウントダウンを実行し、ゼロになったら終了するサービスと、 そのサービスを起動するアクティビティを例に解説します。 アクティビティの作成 サービスを起動するアクティビティを作成します。 ボタンを一つだけ配置したServiceStartActivityを用意します。 Intentによるサービスの起動 ServiceStartActivityでは、ボタンのクリック時にサービスの起動処理を行っています。 Intent intent = new Intent(ServiceStartActivity.this, CountDownService.class); startService(intent); Intentによるサービスの起動はアクティビティの起動によく似ていますが、 Activity起動の時とは違い、コンストラクタには送信元のContextと、起動するServi

    Intentによるサービス起動 - Android Wiki*
  • 1