2011年8月23日火曜日
webOS devs: Microsoft offers free phones and training for Windows Phone 7
As a result of the shocking webOS news from HP Brandon again did the smart thing and offered any published webOS developer the opportunity for free phones, development tools, training, and more. I am not a developer myself, but from what I understand the tools for WP7 development are fairly straightforward and Microsoft is great at helping developers out.
Readers know I am a huge fan of the WP7 platform and find the Metro UI attractive and functional. I love the apps and games on Windows Phone and hopefully we see lots of developers taking advantage of this offer from Brandon.
2011年8月22日月曜日
アクティビティのライフサイクルと主なメソッド
アクティビティの起動
| //アプリ生成時に呼ばれる 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() |