Presentation is loading. Please wait.

Presentation is loading. Please wait.

Activity Applications were originally built on the Activity class. AD * : “An activity is a single, focused thing that the user can do. Almost all activities.

Similar presentations


Presentation on theme: "Activity Applications were originally built on the Activity class. AD * : “An activity is a single, focused thing that the user can do. Almost all activities."— Presentation transcript:

1 Activity Applications were originally built on the Activity class. AD * : “An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(View). “setContentView(View) * AD signifies a direct quote from Android Documentation.

2 AD: “An intent is an abstract description of an operation to be performed…Its most significant use is in the launching of activities, where it can be thought of as the glue between activities.” Activity Intent Intent mapIntent = new Intent(this, MapActivity.class); startActivity(mapIntent); Intent mapIntent = new Intent(this, MapActivity.class); startActivity(mapIntent);

3 AD: “Android introduced fragments in Android 3.0 (API level 11), primarily to support more dynamic and flexible UI designs on large screens, such as tablets. Because a tablet's screen is much larger than that of a handset, there's more room to combine and interchange UI components. Fragments allow such designs without the need for you to manage complex changes to the view hierarchy. By dividing the layout of an activity into fragments, you become able to modify the activity's appearance at runtime and preserve those changes in a back stack that's managed by the activity.” Fragment Activity

4 AD: “You can think of a fragment as a modular section of an activity, which has its own lifecycle, receives its own input events, and which you can add or remove while the activity is running (sort of like a "sub activity" that you can reuse in different activities). ” Fragment Activity FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(android.R.id.content, mMapFragment).commit(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(android.R.id.content, mMapFragment).commit();

5 Fragment Activity Fragment Another Activity Another Activity Yet Another Activity Yet Another Activity Intent An Activity with a collection of Fragments can use an Intent to launch another Activity and associated Fragments. An Activity with a collection of Fragments can use an Intent to launch another Activity and associated Fragments. Intent

6 Fragment Activity Reusable Fragments: Created in the Activity Known by the Activity Exchange of information between Fragments is accomplished by routing information through the Activity

7 Image courtesy of dream designs at FreeDigitalPhotos.netFreeDigitalPhotos.net

8 Application Icon/Application Name Action Bar Fragment Content

9 Fragments Activity

10 Only one Fragment is shown at a time. Typical Fragment Operations: add, remove, show, hide and replace

11 Resource File Layout File Action Bar


Download ppt "Activity Applications were originally built on the Activity class. AD * : “An activity is a single, focused thing that the user can do. Almost all activities."

Similar presentations


Ads by Google