120 likes | 134 Views
lec 02. Activities Activity Lifecycle Multiple Activities Views Menus and Dialogs. Building Blocks of an App. Activities Intents Services Content Providers Broadcast Recievers. Activities. Equivalent to Forms in Swing and other programming environments. Activities are loosely bound
E N D
lec 02 Activities Activity Lifecycle Multiple Activities Views Menus and Dialogs
Building Blocks of an App • Activities • Intents • Services • Content Providers • Broadcast Recievers
Activities • Equivalent to Forms in Swing and other programming environments. • Activities are loosely bound • Activities are on a "Back Stack" and are popped off when the back button is hit.
Inter- and intra-application communication are done with intents. You send an intent to the andriod-system and it takes care of that request.
Views Views are essentially UI controls (aka widgets – but not to be confused with home-page widgets) View is the grand-daddy of all subclassed Views such as TextView, WebView, EditText, Button, etc. Drag views onto Activities and describe them with XML properties. You may use DroidDraw to generate XML.
Menus Options Menu – opened when you click your menu button on your phone. Context Menu – aka PopMenu opened with you long-click a View.
Styles Styles are defined in an XML file like such: <?xmlversion="1.0"encoding="utf-8"?> <resources> <stylename="label"parent="@android:style/TextAppearance"> <itemname="android:layout_marginLeft">10dp</item> <itemname="android:layout_weight">15</item> … Styles are used to define the properties of a widget and then applied to each widget who should look alike. Changing styles can be done in one place—the resource xml.
Themes Themes can be custom styles or built-in themes. In the manifest file, you would insert it like this: <application android:theme="@style/CustomTheme"> Or like this: <activity android:theme="@android:style/Theme.Translucent"> Themes can apply to entire applications (all the activities therein), or individual activities.