アクティビティとは、ユーザーとアプリケーションを仲介する画面の要素です。
アプリケーションはActivityクラス、もしくはそれを継承したクラスを必ず持たなければなりません。そしてそのクラスが、アプリケーションのエントリポイントとなります。
| クラス | 説明 | ||||||
|---|---|---|---|---|---|---|---|
| AccountAuthenticatorActivity | |||||||
| ActivityGroup |
|
||||||
| AliasActivity | |||||||
| ExpandableListActivity | 伸縮可能な一覧 (ExpandableListView) の表示や一覧から選択するイベントリスナーを提供する | ||||||
| ListActivity | 一覧 (ListView) の表示や一覧から選択するイベントリスナーを提供する
|
||||||
| NativeActivity |
アクティビティのライフサイクルはコンフィグレーションの変化に影響を受けるため、この変化に正しく対応する必要があります。
| 定数 | 値 | 説明 |
|---|---|---|
| mcc | 0x0001 | The IMSI MCC has changed, that is a SIM has been detected and updated the Mobile Country Code. |
| mnc | 0x0002 | The IMSI MNC has changed, that is a SIM has been detected and updated the Mobile Network Code. |
| locale | 0x0004 | The locale has changed, that is the user has selected a new language that text should be displayed in. |
| touchscreen | 0x0008 | The touchscreen has changed. Should never normally happen. |
| keyboard | 0x0010 | The keyboard type has changed, for example the user has plugged in an external keyboard. |
| keyboardHidden | 0x0020 | The keyboard or navigation accessibility has changed, for example the user has slid the keyboard out to expose it. Note that despite its name, this applied to any accessibility: keyboard or navigation. |
| navigation | 0x0040 | The navigation type has changed. Should never normally happen. |
| orientation | 0x0080 | The screen orientation has changed, that is the user has rotated the device. |
| screenLayout | 0x0100 | The screen layout has changed. This might be caused by a different display being activated. |
| uiMode | 0x0200 | The global user interface mode has changed. For example, going in or out of car mode, night mode changing, etc. |
| fontScale | 0x40000000 | The font scaling factor has changed, that is the user has selected a new global font size. |
setContentView()では、アクティビティに指定要素を設定します。
public void setContentView (int layoutResID)setContentView - Activity | Android Developers
public void setContentView (View view)
public void setContentView (
View view,
ViewGroup.LayoutParams params
)