activity applications were originally built on the activity class. ad * : “an activity is a...

Download 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

If you can't read please download the document

Upload: rocco-eliot

Post on 14-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

  • Slide 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. Slide 2 AD: An intent is an abstract description of an operation to be performedIts 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); Slide 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 Slide 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(); Slide 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 Slide 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 Slide 7 Image courtesy of dream designs at FreeDigitalPhotos.netFreeDigitalPhotos.net Slide 8 Application Icon/Application Name Action Bar Fragment Content Slide 9 Fragments Activity Slide 10 Only one Fragment is shown at a time. Typical Fragment Operations: add, remove, show, hide and replace Slide 11 Resource File Layout File Action Bar"> Resource File Layout File Action Bar