Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mobile Applications (Android Programming)

Similar presentations


Presentation on theme: "Mobile Applications (Android Programming)"— Presentation transcript:

1 Mobile Applications (Android Programming)
Semester II Dr. Saman Mirza Abdullah

2 Class Objective The objective of this class is: What is Fragments?
Organizing Activity components with Fragments. Intent : Activities communication and transition Manifest file content. Mobile Application - Ishik

3 Activity and Screen Until version 3.0 (API Level 11, relation between Activity class and Application screen was one-to-one. For each screen in your app, you defined an Activity to manage its user interface For complicated application, this concept doesn't work well. There were times when screen functionality needed to be componentized at a lower level than the Activity class. Therefore, Android 3.0 introduced a new concept called fragments. Mobile Application - Ishik

4 Fragments A fragment is a chunk of screen functionality or user interface with its own lifecycle that can exist within an activity and is represented by the Fragment class (android.app.Fragment) and several supporting classes. A Fragment class instance must exist within an Activity instance (and its lifecycle), but fragments need not be paired with the same Activity class each time they are instantiated. Mobile Application - Ishik

5 Fragments work flow activities
How they make application more flexible? An example on MP3 music player application. (without fragments) Mobile Application - Ishik

6 Fragments work flow activities
How they make application more flexible? An example on MP3 music player application. (with Fragments) Mobile Application - Ishik

7 Intents It is communication between two Activities.
It is the management of Activities transition (A process of changing the state to another / from one activities to another). Activity states are necessary to be considered while a transition is applying. We need to understand the states of activies. Mobile Application - Ishik

8 Activity States and Intents
Any activity class may has one of the following states: Mobile Application - Ishik

9 Activity States Example
When an application start up with a Menu scree and then goes to the screen on one items of the menu that permanently discard the menu screen. User cannot go back to the start up screen. Methods used are: StratActivity() Finish() Screens can temporary discard main screen. onpause(). onResume(). Mobile Application - Ishik

10 Lunching New Activities
There are different ways to lunch new Activities from main ones. The simplest one is using context object: Calling through the class name of an Activity. The object calls startActivity() method. It has only one parameter, Intent. The intent requests the lunch of target activity, which is named by MyDrawActivity as a class. The code used to transition between two Activities. It can be used for requesting data between Activities. Mobile Application - Ishik

11 Transitions and Intents
Android applications are flexible for selecting an entry point. An Activity can be designated as an entry point. It should be mentioned in the AndroidMainfes.xml file. Other Activities could be chosen and lunched from main lunched Activity. Music playlist application is the main Activity lunched, and the playlist Activity could be pointed for lunching. Mobile Application - Ishik

12 Lunch Another Activity
An Intent can be used to call / lunch an activity of other application. An application needs to call a customer, and needs to used the call number inside the contact number application. Uri, is Uniform Resource Identifier. Mobile Application - Ishik

13 Core Files and Directories
Every Android application has a set of core files that are created and used to define the functionality of the application. The following files are created by default with a new Android application: AndroidManifest.xml—the central configuration file for the application. It defines your application’s capabilities and permissions as well as how it runs. Mobile Application - Ishik

14 Core Files and Directories
Every Android application has a set of core files that are created and used to define the functionality of the application. The following files are created by default with a new Android application: AndroidManifest.xml—the central configuration file for the application. It defines your application’s capabilities and permissions as well as how it runs. Android application uses this special configuration file to set the properties of the android project. Mobile Application - Ishik

15 Core Files and Directories
Android application uses this special configuration file to set the properties of the android project, such as Application name Application version Permissions to get other applications Permissions to open for other applications Components that composed the application Application’s identity Mobile Application - Ishik

16 Core Files and Directories Android Manifest.xml file
The Android application manifest file is a specially formatted XML file. Should be exist within an Android application. It comes with the name AndroidManifest.xml. Should come at the top of the application. Mobile Application - Ishik

17 Core Files and Directories Android Manifest.xml file
The file used by the Android system to Install and upgrade the application package. Display the application details. Specify application system requirements, including which Android SDKs are supported, what device configurations are required (for example, D-pad navigation), and which platform features the application relies upon (for example, multi-touch capabilities) Register application activities and when they should be launched. Manage application permission Specify Intent processes. Android project wizard creates AndroidManifest.xml file, while IDE Android is using. Mobile Application - Ishik

18 Editing Android Manifest.xml file
The file is at the top level of Android application. Android IDE manifest file resource editor could be used to edit the project manifest file. The Android IDE manifest file resource editor organizes the manifest information into categories: The Manifest tab The Application tab The Permissions tab The Instrumentation tab The AndroidManifest.xml tab Mobile Application - Ishik

19 Manifest taps Mobile Application - Ishik

20 Manifest taps The Manifest tab contains package-wide settings, including the package name, version information, and supported Android SDK information. Can also set any hardware or feature requirements here. Mobile Application - Ishik

21 Application taps The Application tab contains application-wide settings, including The application label and icon, As well as information about the application components, such as activities, Other application components, including configuration for services, Intent filters, and Content providers. Mobile Application - Ishik

22 Permissions and Instrumentation taps
The Permissions tab contains any permission rules required by your application. This tab can also be used to enforce custom permissions created for the application. The Instrumentation tab allows the developer to declare any instrumentation classes for monitoring the application. Mobile Application - Ishik

23 Editing Manifest Manually
Mobile Application - Ishik

24 Editing Manifest Manually
Mobile Application - Ishik

25 Summary of the file Here is a summary of what this file tells us about the SimpleMultimedia application: The application uses the package name com.introtoandroid.simplemultimedia. The application version name is 1.0. The application version code is 1. The application name and label are stored in the resource string app_name within the /res/values/strings.xml resource file. Mobile Application - Ishik

26 Summary of the file The application is debuggable on an Android device. The application icon is the graphics file called ic_launcher (which could be a PNG, JPG, or GIF) stored within the /res/drawable-* directory (there are actually multiple versions for different pixel densities). The application has four activities (SimpleMultimediaActivity, AudioActivity, StillImageActivity, and VideoPlayActivity). SimpleMultimediaActivity is the primary entry point for the application because it handles the action android.intent.action.MAIN. This Activity shows in the application launcher, because its category is android.intent.category.LAUNCHER. Mobile Application - Ishik

27 Summary of the file The application requires the following permissions to run: the ability to write settings, the ability to record audio, the ability to set the wallpaper on the device, the ability to access the built-in camera, the ability to communicate over the Internet, and the ability to write to external storage. The application works from any API level from 10 to 18; in other words, Android SDK is the lowest supported platform version, and the application was written to target Jelly Bean MR2 (for example, Android 4.3). Finally, the application requests to use the camera with the <uses-feature> tag Mobile Application - Ishik

28 Class End Mobile Application - Ishik


Download ppt "Mobile Applications (Android Programming)"

Similar presentations


Ads by Google