アクティビティの起動
| //アプリ生成時に呼ばれる public void onCreate(Bundle bundle) { super.onCreate(bundle); } //アプリスタート時に呼ばれる @Override public void onStart() { super.onStart(); } //アプリレジューム時に呼ばれる @Override public void onResume() { super.onResume(); } //アプリポーズ時に呼ばれる @Override public void onPause() { super.onPause(); } //アプリストップ時に呼ばれる @Override public void onStop() { super.onStop(); } //アプリ破棄時に呼ばれる @Override public void onDestroy() { super.onDestroy(); } |
アクティビティの起動
| メソッド | 説明 |
| void startActivity(Intent intent) | アクティビティの起動 |
| void startActivityForResult(Intent intent,int requestCode) | アクティビティの起動 |
| void startActivityFromChild(Activity child,Intent intent,int requestCode) | 任意のアクティビティからのアクティビティ起動 |
| boolean startActivityNeeded(Intent intent,int requestCode) | - |
Activity関連のクラス
| メソッド | 説明 |
| Contextクラス | アプリケーション全体で利用する情報や操作を提供 |
| Activityクラス | アクティビティ |
| ActivityGroupクラス | アクティビティの複数表示 |
| TabActivityクラス | タブ表示 |
| ListActivityクラス | リスト表示 |
| LauncherActivity | アクティビティのリスト表示 |
| MapActivityクラス | 地図表示 |
Activityクラスの主なメソッド
| メソッド | 説明 |
| void setIntent(Intent intent) | インテントの指定 |
| Intent getIntent() | アクティビティ開始時に利用したインテントを取得 |
| | |
| void setContentView(View view) | ビューの指定 |
| void setContentView(View view,LayoutParams params) | ビューの指定 |
| void setContentView(int layoutResID) | ビューの指定 |
| View findViewById(int id) | リソースに定義されているビューを取得 |
| | |
| void startActivity(Intent intent) | アクティビティの起動 |
| void startActivityForResult(Intent intent,int requestCode) | アクティビティの起動。戻り値あり |
| void startActivityFromChild(Activity child,Intent intent,int requestCode) | 任意のアクティビティからのアクティビティ起動 |
| boolean startActivityNeeded(Intent intent,int requestCode) | アクティビティの起動 |
| void finish() | アクティビティの終了 |
| void finishActivity(int requestCode) | アクティビティの終了。戻り値あり |
| void finishActivityFromChild(Activity child,int requestCode) | 任意のアクティビティの起動。戻り値あり |
| void finishFromChild(Activity child) | 任意のアクティビティの起動 |
| | |
| void setResult(int resultCode) | 呼び出し元に返すパラメータを指定 |
| void setResult(int resultCode,String data) | 呼び出し元に返すパラメータを指定 |
| void setResult(int resultCode,String data,Bundle extras) | 呼び出し元に返すパラメータを指定 |
| | |
| SharedPreferences getPreferences(int mode) | SharedPreferencesオブジェクトを取得 |
| Window getWindow() | Windowオブジェクトを取得 |
| WindowManager getWindowManager() | WindowManagerオブジェクトを取得 |
| | |
| boolean onKeyDown(int keyCode,KeyEvent event) | キーイベントの処理を記述 |
| boolean onMenuItemSelected(int featureId,Item item) | メニューアイテムイベントの処理を記述 |
| boolean onCreateOptionsMenu(Menu menu) | メニュー生成時の処理を記述 |
| boolean onPrepareOptionMenu(Menu menu) | メニュー変化時の処理を記述 |
| void onWindowAttributesChanged(LayouytParams params) | ウィンドウの属性変化時の処理を記述 |
| void onWindowFocusChanged(boolean hasFocus) | ウィンドウのフォーカス変更時の処理を記述 |
画面の縦横切り換えイベント
| 説明 | 関連メソッド |
| 設定は必要なし | onCreate() |
| AndroidManifest.xmlにandroid:configChanges= | onConfigurationChanged() |
0 件のコメント:
コメントを投稿