1. Explain the architecture of an Android OS. 10M The following diagram shows the architecture of an Android OS.

Size: px
Start display at page:

Download "1. Explain the architecture of an Android OS. 10M The following diagram shows the architecture of an Android OS."

Transcription

1 1. Explain the architecture of an Android OS. 10M The following diagram shows the architecture of an Android OS. Android OS architecture is divided into 4 layers : Linux Kernel layer: 1. Linux Kernel layer 2. Libraries & Android Runtime 3. Application framework 4. Applications This is the heart of the Android OS. This layer contains all the low level device drivers for the various hardware components of an Android device. It provides the following functionalities in the Android system. Hardware Abstraction Memory Management Programs Security Settings Power Management Software Other Hardware Drivers (Drivers are programs that control hardware devices.) Support for Shared Libraries Network stack Libraries & Android Runtime Layer: Libraries: Libraries carry a set of instructions to guide the device in handling different types of data. This layer contains all the code that provides the main features of an Android OS. For example, the SQLite library provides database support so that an application can use it for data storage. The WebKit library provides functionalities for web browsing. Department of Information Technology 1

2 Surface Manager: It is used for compositing window manager with off-screen buffering. Off-screen buffering means you can not directly draw into the screen, but your drawings go to the off-screen buffer. There it is combined with other drawings and form the final screen the user will see. This off screen buffer is the reason behind the transparency of windows. SQLite: SQLite is the database engine used in android for data storage purposes WebKit: It is the browser engine used to display HTML content OpenGL: Used to render 2D or 3D graphics content to the screen SGL (Scalable Graphics Library): 2D Graphics Open GL ES: 3D Library Media Framework: Supports playbacks and recording of various audio, video and picture formats. Free Type: Font Rendering libc (System C libraries) Open SSL (Secure Socket Layer ): A cryptographic protocol for providing secure communication over the internet. ( ex: internet banking) Android Runtime: At the same layer as the libraries, the Android runtime provides a set of core libraries that enable developers to write Android apps using the Java programming language. The Android runtime also includes the Dalvik virtual machine, which enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine (Android applications are compiled into the Dalvik executables). Dalvik is a specialized virtual machine designed specifically for Android and optimized for battery-powered mobile devices with limited memory and CPU. Application framework layer: Exposes the various capabilities of the Android OS to application developers so that they can make use of them in their applications. Our applications directly interact with these blocks of the Android architecture. These programs manage the basic functions of phone like resource management, voice call management etc. Important blocks in this layer are: Activity Manager: Manages the activity life cycle of applications. To understand the Activity component in Android Content Providers: Manage the data sharing between applications. Telephony Manager: Manages all voice calls. We use telephony manager if we want to access voice calls in our application. Location Manager: Location management, using GPS or cell tower Resource Manager: Manage the various types of resources we use in our Application. Applications Layer: At this top layer, you will find applications that ship with the Android device (such as Phone, Contacts, Browser, etc.), as well as applications that you download and install from the Android Market. Any applications that you write are located at this layer. Example applications are: SMS client app Dialer Web browser Contact manager Google Maps Gallery Department of Information Technology 2

3 2. a) Explain various constraints and requirements of mobile applications. 5M Constraints related to mobile applications: 1. The challenge of designing and developing multiple versions of an application to run on a wide variety of platforms (BlackBerry, iphone, Windows Mobile, and others) and significantly different device models on a given platform (e.g. BlackBerry Bold, Storm, Curve, Pearl Flip) in a manner that exploits the unique capabilities of each device while maximizing software reuse and development efficiency. 2. Small screen size means that less of a page or form can be displayed, making it more difficult to maintain the user's sense of location within the application and navigation scheme. 3. A variety of different screen sizes, resolutions and orientations (portrait, landscape, switchable) to design for. 4. Limited input devices and a variety of possible interaction methods (keypad, stylus, touch screen). 5. Text input is particularly cumbersome. 6. Limited battery life requires that power-consuming activities must be carefully managed. 7. Limited processing power, limited storage and working memories; 8. Unpredictable network connection, limited coverage and lower network bandwidth than a fixed connection; 9. Bandwidth cost considerations where network connectivity is charged per data volume; 10. A range of challenging usage environments, including extremes in ambient lighting, noise and temperature (the user may be wearing gloves or lose dexterity in cold conditions) all affecting the user's ability to interact with the device. 11. Additional challenges for developers are to learn proprietary technologies, development tools and APIs for different specification and it is also a long term process for a software vendor. Among them, vital technologies challenges are data Synchronization and communication complexities, middleware architecture, platform security, scalability and Integration with business system. 12. Also surrounding technologies like LTE, thunderbolt, tethering, cloud computing, etc change the pattern of usages smart phone. Basic requirements of Mobile Applications: 1. Platform: All mobile phones are not using same operational platform. Choose the platform, which is used by many mobile phones consider the level of target users too. J2ME / Java based applications are one example It works on many Nokia, LG and Samsung devices and these devices are dominating the Indian mobile device market for long time. Developing a J2ME based app, increases the download opportunities by the users of these devices. 2. HELP: Many Mobile apps are not having a good help section. A help can be a simple section with application intro, keys information, and version information. 3. Simple Keys: The less keys the more advantage. Try to create functions for most common keys and I suggest matching with the default device keys. You can have different builds for different devices. The user should feel comfort in handling your app it makes him use it frequently. 4. Web-Site: Have a small website with Basic and advance download information, supporting devices lists, contact information, Issue posting- tracking-responses section, Build version information etc. Non Functional Requirements: 1. Availability 2. Performance 3. Scalability 4. Extensibility 5. Usability 6. Reliability 7. Maintainability 8. Security 9. Privacy Department of Information Technology 3

4 2. b) Explain about intents in android. 5M Intents are used to call built in applications Pass data to an activity To return data from an activity An intent contains action and data. The action describes what is to be performed and data specifies what is affected such as a person in the contacts database. The data is specified as an Uri object. Some examples of action are as follows: ACTION_VIEW ACTION_DIAL ACTION_PICK ACTION_CALL Some examples of data include the following: tel: geo: , content://contacts Collectively, the action and data pair describes the operation to be performed. For example, to dial a phone number, you would use the pair ACTION_DIAL/tel: To display a list of contacts stored in your phone, you use the pair ACTION_VIEW/content://contacts. To pick a contact from the list of contacts, you use the pair ACTION_PICK/content://contacts. Creating and starting an Intent example: Intent i = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse( )); startactivity(i); in the above statement, parse method converts URL string to Uri object. Intent used for returning data from an activity: If the application is returing value ( for example contact information in case of contacts application), you invoke it using the startactivityforresult() method, passing in the Intent object and a request code. You need to implement the onactivityresult() method in order to obtain a result from the activity: Example: In oncreate() method, add the following code: Intent i = new Intent(android.content.Intent.ACTION_PICK); i.settype(contactscontract.contacts.content_type); startactivityforresult(i,request_code); Add the following method to MainActivity class: public void onactivityresult(int requestcode, int resultcode, Intent data) { if (requestcode == request_code) { if (resultcode == RESULT_OK) { Toast.makeText(this,data.getData().toString(), Toast.LENGTH_SHORT).show(); Intent i = new Intent( android.content.intent.action_view, Uri.parse(data.getData().toString())); startactivity(i); Department of Information Technology 4

5 Intent used for passing data to an activity: Add the following code in the place where you want to pass the data to another activity. Intent i = new Intent( net.learn2develop.activity2 ); Bundle extras = new Bundle(); extras.putstring( Name, Your name here ); i.putextras(extras); startactivityforresult(i, 1); In Activity2.java file, oncreate() method, add the following code: String defaultname= ; Bundle extras = getintent().getextras(); if (extras!=null) { defaultname = extras.getstring( Name ); Intent Filters: In order for other activities to invoke your activity, you need to specify the action and category within the <intent-filter> element in the AndroidManifest.xml file, like this: <intent-filter> <action android:name= net.learn2develop.activity2 /> <category android:name= android.intent.category.default /> </intent-filter> Example: In an AndroidManifest.xml file, add the following: <activity android:name=.mybrowseractivity > <intent-filter> <action android:name= android.intent.action.view /> <action android:name= net.learn2develop.mybrowser /> <category android:name= android.intent.category.default /> <data android:scheme= http /> </intent-filter> </activity> In the <intent-filter> element, you declared it to have two actions, one category, and one data. This means that all other activities can invoke this activity using either the android.intent.action.view or the net.learn2develop.mybrowser action. For all activities that you want others to call using the start Activity() or startactivityforresult() methods, they need to have the android.intent.category.default category. If not, your activity will not be callable by others. The <data> element specifies the type of data expected by the activity. In this case, it expects the data to start with the prefix. Department of Information Technology 5

6 3. a) Explain the anatomy of an Android application. 5M Above diagram shows anatomy (structure) of an android application. Every Android Application contains the following folders. Each folder contains standard file(s) which is used for a specific purpose. Description regarding each folder and its contents is given below: src folder :Contains the.java source files for your project. Inthis example, there is one file, MainActivity.java. TheMainActivity.java file is the source file for your activity.you will write the code for your application in this file. Android library : Contains android.jar, which contains all the class libraries needed for your appl. gen folder: contains R.java a compiler-generated file which references all the resources found in your project. You should not modify this file. assets :Contains all the assets ( html, text files and databases)used by your project. res: Folder which contains all the resources used in your prj. Contains drawable, values, layout folders etc.. AndroidManifest.xml :Specifies permissions for your application and other features such as intent-filters and receivers. Department of Information Technology 6

7 3. b) Explain the life cycle of an activity. 5M The following diagram shows the life cycle of an activity. An activity main states are : Resumed: In this state, activity is in the foreground and the user can interact with it. Also called running state. Paused: In this state, the activity is partially obscured by another activity. The other activity does not cover full screen.the paused activity does not receive user input and cannot execute any code. Stopped: In this state, the activity is completely hidden and not visible to the user. Activity information and all of its state ( variables ) is retained, but it cannot execute any code. Department of Information Technology 7

8 The Activity base class defines a series of events that governs the life cycle of an activity. The Activity class defines the following events: oncreate() Called when the activity is first created onstart() Called when the activity becomes visible to the user onresume() Called when the activity starts interacting with the user onpause() Called when the current activity is being paused and the previous activity is being resumed onstop() Called when the activity is no longer visible to the user ondestroy() Called before the activity is destroyed by the system (either manually or by the system to conserve memory) onrestart() Called when the activity has been stopped and is restarting again Case 1:When the activity is first loaded into memory, the following methods are called in sequence. oncreate( ) onstart( ) onresume( ) Case 2:When you now press the back button on the Android Emulator, sequence of methods called are onpause( ) onstop( ) ondestroy( ) Case 3: Click the Home button and hold it there. In the Home Screen, click the App Launcher Icon. Then the following methods are called in sequence. oncreate( ) onstart( ) onresume( ) Case 4: Press the Phone button on the Android Emulator so that the activity is pushed to the background. Then the following two methods are called in sequence. onpause( ) onstop( ) Case 5: Exit the phone dialer by pressing the Back button. The activity is now visible again. Then the following two methods are called in sequence. onrestart( ) onstart( ) onresume( ) The activity life cycle diagram can be redrawn as follows which covers all the above cases. Department of Information Technology 8

9 4. a) Explain the various features of an Android OS. 5M Various features of the Android OS include : Storage: Uses SQLite, a light weight relational database, for data storage. Connectivity: Android Supports technologies including GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth (includesa2dp and AVRCP), WiFi, LTE, and WiMAX. Messaging: SMS and MMS are available forms of messaging, including threaded text messaging and Android Cloud To Device Messaging (C2DM) and now enhanced version of C2DM, Android Google Cloud Messaging (GCM) is also a part of Android Push Messaging service. Web browser: The web browser available in Android is based on the open source webkit layout engine, coupled with Chrome's V8 JavaScript engine. Media support: Includes support for the following media: H.263, H.264 (in 3GP or MP4 container), MPEG-4 SP, AMR, AMR-WB (in 3GP container), AAC, HE-AAC (in MP4 or 3GP container), MP3, MIDI, OggVorbis, WAV, JPEG, PNG, GIF, and BMP. Streaming Media Support: RTP/RTSP streaming (3GPP PSS, ISMA), HTML progressive download (HTML5 <video> tag). Adobe Flash Streaming (RTMP) and HTTP Dynamic Streaming are supported by the Flash plugin. Apple HTTP Live Streaming is supported by RealPlayer for Android, and by the operating system in Android 3.0 (Honeycomb). Hardware support: Android can use video/still cameras, touchscreens, GPS, accelerometers, gyroscopes, barometers,magnetometers, dedicated gaming controls, proximity and pressure sensors, thermometers, accelerated 2Dbit blits (with hardware orientation, scaling, pixel format conversion) and accelerated 3D graphics. Multi-touch - Supports multi-touch screens Bluetooth: Supports A2DP, AVRCP, sending files (OPP), accessing the phone book (PBAP), voice dialing and sending contacts between phones. Keyboard, mouse and joystick (HID) support is available in Android 3.1+, and in earlier versions through manufacturer customizations and thirdparty applications. Video calling: Android does not support native video calling, but some handsets have a customized version of the operating system that supports it, either via the UMTS network (like the Samsung Galaxy S) or over IP. Video calling through Google Talk is available in Android and later. Gingerbread allows Nexus S to place Internet calls with a SIP account. This allows for enhanced VoIP dialing to other SIP accounts and even phone numbers. Skype 2.1 offers video calling in Android 2.3, including front camera support. Users with the Google + android app can video chat with other google+ users through hangouts. Multi-tasking: Supports multi-tasking applications Flash support: Android 2.3 supports Flash Tethering: Supports sharing of Internet connections as a wired/wireless hotspot Screen capture: Android supports capturing a screenshot by pressing the power and volume-down buttons at the same time. Prior to Android 4.0, the only methods of capturing a screenshot were through manufacturer and third-party customizations or otherwise by using a PC connection (DDMS developer's tool). These alternative methods are still available with the latest Android. Department of Information Technology 9

10 External storage: Most Android devices include microsd slot and can read microsd cards formatted with FAT32, Ext3 or Ext4file system. To allow use of high-capacity storage media such as USB flash drives and USB HDDs. 4. b) Explain adapting to display orientation. 5M One of the key features of modern smartphones is their ability to switch screen orientation, andandroid is no exception. Android supports two screen orientations: portrait and landscape. By default,when you change the display orientation of your Android device, the current activity that is displayedwill automatically redraw its content in the new orientation. This is because the oncreate() event ofthe activity is fired whenever there is a change in display orientation. However, when the views are redrawn, they may be drawn in their original locations (depending onthe layout selected). As you can observe in landscape mode, a lot of empty space on the right of the screen could be used.furthermore, any additional views at the bottom of the screen would be hidden when the screen orientationis set to landscape. In general, you can employ two techniques to handle changes in screen orientation: Anchoring views The easiest way is to anchor your views to the four edges of the screen. When the screen orientation changes, the views can anchor neatly to the edges. Resizing and repositioning Whereas anchoring and centralizing are simple techniques to ensure that views can handle changes in screen orientation, the ultimate technique is resizing each and every view according to the current screen orientation. Detecting Orientation Changes Programatically: Sometimes you need to know the device s current orientation during run time. To determine that, you can use the WindowManager class. The following code snippet demonstrates how you can programmatically detect the current orientation of your activity: MainActivity.java code: importandroid.util.log; importandroid.view.display; importandroid.view.windowmanager; //... public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); //---get the current display info--- WindowManagerwm = getwindowmanager(); Display d = wm.getdefaultdisplay(); if (d.getwidth() >d.getheight()) { //---landscape mode--- Log.d( Orientation, Landscape mode ); else { //---portrait mode--- Log.d( Orientation, Portrait mode ); Department of Information Technology 10

11 To display your activity in a certain orientation: For example, you may be writing a game that should only be viewed in landscape mode. In thiscase, you can programmatically force a change in orientation using the setrequestorientation() method of the Activity class: In MainActivity.java file: import android.content.pm.activityinfo; public class MainActivity extends Activity { /** Called when the activity is first created. public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); //---change to landscape mode--- setrequestedorientation(activityinfo.screen_orientation_landscape); Besides using the setrequestorientation() method, you can also use the android:screenorientation attribute on the <activity> element in AndroidManifest.xml as follows to constrain the activity to acertain orientation: In activity_main.xml file: <?xml version= 1.0 encoding= utf-8?> <manifest xmlns:android= package= net.learn2develop.orientations android:versioncode= 1 android:versionname= 1.0 > <application > <activity android:name=.mainactivity android:screenorientation= landscape > <intent-filter> <action android:name= android.intent.action.main /> <category android:name= android.intent.category.launcher /> </intent-filter> </activity> </application> <uses-sdkandroid:minsdkversion= 9 /> </manifest> The preceding example constrains the activity to a certain orientation (landscape in this case) and preventsthe activity from being destroyed; that is, the activity will not be destroyed and the oncreate()event will not be fired again when the orientation of the device changes. 5. a) Explain various views available in Android application. 5M Android supports 3 types of view groups: Basic views Commonly used views such as the TextView, EditText, and Button Views Picker views Views that enable users to select from a list, such as the TimePicker And DatePicker views List views Views that display a long list of items, such as the ListView and the SpinnerView views Department of Information Technology 11

12 Basic Views: TextView EditText Button ImageButton CheckBox ToggleButton RadioButton RadioGroup Button Represents a push-button widget ImageButton Similar to the Button view, except that it also displays an image EditText A subclass of the TextView view, except that it allows users to edit its text content CheckBox A special type of button that has two states: checked or unchecked RadioGroup and RadioButton The RadioButton has two states: either checked or unchecked. Once a RadioButton is checked, it cannot be unchecked. A RadioGroup is used to group together one or more RadioButton views, thereby allowing only one RadioButton to be checked within the RadioGroup. ToggleButton Displays checked/unchecked states using a light indicator Processing Button events: Step 1: In activity_main.xml file, add the following code: <Button android:id="@+id/button1" android:text="@string/button_str" android:textcolor="@android:color/background_dark" android:textsize="15sp" /> Step 2: in MainActivity.java file oncreate( ) method, add the following code : Button btn=(button)findviewbyid(r.id.button1); btn.setonclicklistener(new View.OnClickListener() { public void onclick(view arg0) { Toast.makeText(getBaseContext(),"Clicked Button", Toast.LENGTH_SHORT).show(); ); When you run the program, after clicking button, a toast message Clicked Button will be displayed. Creating and using TimePicker view: Step 1: in activity_main.xml file, add the following code: <TimePicker android:id="@+id/timepicker1" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_margintop="41dp" /> Step 2: In MainActivity.java file oncreate() method, add the following code: tpicker=(timepicker)findviewbyid(r.id.timepicker1); // button Button btn=(button)findviewbyid(r.id.button1); btn.setonclicklistener(new View.OnClickListener() { Department of Information Technology 12

13 @Override public void onclick(view arg0) { String str="time Selected :"+tpicker.getcurrenthour().tostring() +" "+tpicker.getcurrentminute().tostring(); Toast.makeText(getBaseContext(),str, Toast.LENGTH_SHORT).show(); ); When you run the program, after selecting time from the TimePicker view, a toast message Time Selected : 09:30 will be displayed. 5. b) Explain how to handle list views in Android. 5M Creating and using ListView view: Step 1: Add the following imports in imports section of MainActivity.java file: import android.view.menu; import android.app.listactivity; import android.view.view; import android.widget.arrayadapter; import android.widget.listview; import android.widget.toast; Step 2: change the base class of MainActivity to ListActivity Step 3: in MainActivity class, add the following: String[] presidents = { "Dwight D. Eisenhower", "John F. Kennedy", "Lyndon B. Johnson", "Richard Nixon", "Gerald Ford", "Jimmy Carter", "Ronald Reagan", "George H. W. Bush", "Bill Clinton", "George W. Bush", "Barack Obama" ; Step 4: comment out setcontentview() method and add the following in oncreate() setlistadapter(new ArrayAdapter<String>(this, android.r.layout.simple_list_item_1, presidents)); Step 5: Add the following method in the MainActivity class public void onlistitemclick(listview parent, View v, int position, long id) { Toast.makeText(this,"You have selected " + presidents[position],toast.length_short).show(); Department of Information Technology 13

14 Output: On running the program, you will get the following screen. On Selecting 2 nd item, the following output will be generated. Creating and using Spinner view: Spinner View is used when you want to save the screen space. This view will display one item at a time where as normal ListView control display a menu of items which will occupy full screen. Follow the following steps to create and use a Spinner view control in your application. Step 1: In activity_main.xml file, drag and drop Spinner control. You will get the following code. <Spinner android:id="@+id/spinner1" android:drawselectorontop="true" /> Step 2: Add the following code in res\values\strings.xml file: <string name="str_spinner">spinner Demo:</string> <string-array name="presidents_array"> <item>dwight D. Eisenhower</item> <item>john F. Kennedy</item> <item>lyndon B. Johnson</item> <item>richard Nixon</item> <item>gerald Ford</item> <item>jimmy Carter</item> <item>ronald Reagan</item> Department of Information Technology 14

15 <item>george H. W. Bush</item> <item>bill Clinton</item> <item>george W. Bush</item> <item>barack Obama</item> </string-array> Step 3: Add the following imports in import section of MainActivity.java file import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemselectedlistener; import android.widget.arrayadapter; import android.widget.spinner; import android.widget.toast; Step 4: in the MainActivity class, add the following code: String[] presidents; Step 5: in oncreate() method, add the following code at the end: Output: presidents =getresources().getstringarray(r.array.presidents_array); Spinner s1 = (Spinner) findviewbyid(r.id.spinner1); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.r.layout.simple_spinner_item, presidents); s1.setadapter(adapter); s1.setonitemselectedlistener(new OnItemSelectedListener() public void onitemselected(adapterview<?> arg0, View arg1, int arg2, long arg3) { int index = arg0.getselecteditemposition(); Toast.makeText(getBaseContext(),"You have selected item : " + public void onnothingselected(adapterview<?> arg0) { ); When you run the program, you will get the following output: Department of Information Technology 15

16 When you clicked on the right arrow button, the following screen appears: When you selected 11 th item from the dropdown menu, you will get the following display: 6. a) Explain how to create and use menus in Android application. 5M Menus are useful for displaying additional options that are not directly visible on the main UI of an application. There are two main types of menus in Android: Options menu - Displays information related to the current activity. In Android, you activate the options menu by pressing the MENU key. The menu items displayed vary according to the current activity that is running. Context menu - Displays information related to a particular view on an activity. The menu items displayed vary according to the component or view currently selected. To activate the context menu, the user selects an item on the screen and either taps and holds it or simply presses the center button on the directional keypad. Options menu creation and usage: To display the options menu for your activity, you need to override two methods in your activity: oncreateoptionsmenu() and onoptionsitemselected(). The oncreateoptionsmenu() method is called when the MENU button is pressed. In this event, you call the CreateMenu() helper method to display the options menu. When a menu item is selected, the onoptionsitemselected() method is called. In this case, you call the MenuChoice() method to display the menu item selected (and do whatever you want to do). Department of Information Technology 16

17 Steps to create and use Options menu: Step 1: Add the following statements to the MainActivity.java file: import android.view.menu; import android.view.menuitem; import android.widget.button; import android.widget.toast; public boolean oncreateoptionsmenu(menu menu) { super.oncreateoptionsmenu(menu); CreateMenu(menu); return public boolean onoptionsitemselected(menuitem item) { return MenuChoice(item); private void CreateMenu(Menu menu) { //...code for adding menu items to menu private boolean MenuChoice(MenuItem item) { // code for task to be done when a menu item is selected Example: For an options menu with items File, Open, Save, Save As, the following is displayed when you pressed Menu button in the emulator. On clicking Save option, the following screen appears for the application. Department of Information Technology 17

18 Creating and using Context menu: A context menu is usually associated with a view on an activity, and it is displayed when the user long clicks an item. For example, if the user taps on a Button view and hold it for a few seconds, a context menu can be displayed. In MainActivity.java file, add the following lines of code import android.view.menu; import android.view.menuitem; import android.widget.button; import android.widget.toast; import android.view.view; import android.view.contextmenu; import android.view.contextmenu.contextmenuinfo; in oncreate( ) method: Button btn = (Button) findviewbyid(r.id.btn1); btn.setoncreatecontextmenulistener(this); // in the class MainActivity, add the following public void oncreatecontextmenu(contextmenu menu, View view, ContextMenuInfo menuinfo) { super.oncreatecontextmenu(menu, view, menuinfo); CreateMenu(menu); public boolean oncontextitemselected(menuitem item) { return MenuChoice(item); private void CreateMenu(Menu menu) { //code for adding menu items to Context menu private boolean MenuChoice(MenuItem item) { //code for task to be performed when an item in context menu is selected 6. b) Explain View Groups (layouts) available in Android Application. 5M An activity contains Views and ViewGroups. A view is a widget that has an appearance on screen. Examples of views are buttons, labels, and text boxes. A view derives from the base class android.view.view. One or more views can be grouped together into a ViewGroup. A ViewGroup (which is itself a special type of view) provides the layout in which you can order the appearance and sequence of views.examples of ViewGroups include LinearLayout and FrameLayout. A ViewGroup derives from the base class android.view.viewgroup. Department of Information Technology 18

19 Android supports the following View Groups: LinearLayout AbsoluteLayout TableLayout RelativeLayout FrameLayout ScrollView Each View and ViewGroup has a set of common attributes. Common Attributes Used in Views and ViewGroups: Attribute layout_width layout_height layout_margintop layout_marginbottom layout_marginleft layout_marginright layout_gravity layout_weight layout_x layout_y Description Specifies the width of the View or ViewGroup Specifies the height of the View or ViewGroup Specifies extra space on the top side of the View or ViewGroup Specifies extra space on the bottom side of the View or ViewGroup Specifies extra space on the left side of the View or ViewGroup Specifies extra space on the right side of the View or ViewGroup Specifi es how child Views are positioned Specifi es how much of the extra space in the layout should be allocated to the View Specifi es the x-coordinate of the View or ViewGroup Specifi es the y-coordinate of the View or ViewGroup Linear layout: The LinearLayout arranges views in a single column or a single row. Child views can be arranged either vertically or horizontally. in the activity_main.xml file, add the following code to get the linear layout for the views: <LinearLayout xmlns:android=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <TextView android:layout_width="105dp" android:text="@string/hello" /> <Button android:layout_width="160dp" android:text="@string/str_btn1" android:layout_gravity="left" android:layout_weight="0.2" /> Department of Information Technology 19

20 <EditText android:layout_width="fill_parent" android:textsize="18sp" android:layout_weight="0.8" /> </LinearLayout> Graphical Layout mode: With the about layout, you will get a UI screen with one Text box and one Button below it (because of vertical orientation selected). Absolute layout: The AbsoluteLayout enables you to specify the exact location of its children. Consider the following UI defined in activity_main.xml file: <AbsoluteLayout xmlns:android=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <Button android:id="@+id/button1" android:layout_marginleft="17dp" android:layout_margintop="20dp" android:layout_x="126dp" android:layout_y="10dp" android:text="@string/btn1str" /> Department of Information Technology 20

21 <Button android:layout_x="12dp" android:layout_y="100dp" /> </AbsoluteLayout> In the aboue absolute layout, two Button views located at their specified positions using the android_layout_x and android_layout_y attributes. Graphical Layout of the above code: Table layout: The TableLayout groups views into rows and columns. You use the <TableRow> element to designate a row in the table. Each row can contain one or more views. Each view you place within a row forms a cell. The width of each column is determined by the largest width of each cell in that column. In activity_main.xml file, add the following code to get a table layout for the views: <TableLayout xmlns:android=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <TableRow> <TextView android:id="@+id/textview1" android:text="@string/textview1" /> <EditText android:id="@+id/edittext1" android:ems="10" android:inputtype="text"> <requestfocus /> </EditText> </TableRow> Department of Information Technology 21

22 <TableRow> <TextView /> <EditText android:ems="10" android:inputtype="text"/> </TableRow> <TableRow> <CheckBox /> </TableRow> <TableRow > <Button style="?android:attr/buttonstylesmall" /> </TableRow> </TableLayout> GraphicalLayout of the above code: Relative Layout: The RelativeLayout enables you to specify how child views are positioned relative to each other. In activity_main.xml file, add the following code to get a relative layout for the views: <RelativeLayout xmlns:android=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" Department of Information Technology 22

23 tools:context=".mainactivity" > <Button <Button <Button <TextView android:layout_margintop="94dp" android:textappearance="?android:attr/textappearancelarge" /> <EditText android:inputtype="text" android:layout_alignparentright="true" /> <Button android:layout_alignparentright="true" /> </RelativeLayout> Department of Information Technology 23

24 GraphicalLayout of the above code: Frame Layout: The FrameLayout is a placeholder on screen that you can use to display a single view. Views that you add to a FrameLayout are always anchored to the top left of the layout. Example: In activity_main.xml file, add the following code: <RelativeLayout xmlns:android=" xmlns:tools=" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <TextView android:id="@+id/textview1" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:layout_marginleft="18dp" android:layout_margintop="17dp" android:text="@string/reltextviewstr" /> <FrameLayout android:id="@+id/framelayout1" android:layout_alignleft="@+id/textview1" android:layout_alignright="@+id/textview1" android:layout_below="@+id/textview1" android:layout_margintop="26dp" > <ImageView android:contentdescription="@string/contentstringimgview1" android:src="@drawable/pic2" /> Department of Information Technology 24

25 <Button android:layout_width="124dp" /> </FrameLayout> </RelativeLayout> Graphical Layout of the above code: Scroll View: A ScrollView is a special type of FrameLayout in that it enables users to scroll through a list of views that occupy more space than the physical display. The ScrollView can contain only one child view or ViewGroup, which normally is a LinearLayout. Department of Information Technology 25

ANDROID USER INTERFACE

ANDROID USER INTERFACE 1 ANDROID USER INTERFACE Views FUNDAMENTAL UI DESIGN Visual interface element (controls or widgets) ViewGroup Contains multiple widgets. Layouts inherit the ViewGroup class Activities Screen being displayed

More information

A view is a widget that has an appearance on screen. A view derives from the base class android.view.view.

A view is a widget that has an appearance on screen. A view derives from the base class android.view.view. LAYOUTS Views and ViewGroups An activity contains Views and ViewGroups. A view is a widget that has an appearance on screen. A view derives from the base class android.view.view. One or more views can

More information

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices.

Group B: Assignment No 8. Title of Assignment: To verify the operating system name and version of Mobile devices. Group B: Assignment No 8 Regularity (2) Performance(5) Oral(3) Total (10) Dated Sign Title of Assignment: To verify the operating system name and version of Mobile devices. Problem Definition: Write a

More information

UNDERSTANDING ACTIVITIES

UNDERSTANDING ACTIVITIES Activities Activity is a window that contains the user interface of your application. An Android activity is both a unit of user interaction - typically filling the whole screen of an Android mobile device

More information

Introduction To Android

Introduction To Android Introduction To Android Mobile Technologies Symbian OS ios BlackBerry OS Windows Android Introduction to Android Android is an operating system for mobile devices such as smart phones and tablet computers.

More information

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 2 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. Android Widgets There are given a lot of android widgets with simplified

More information

Android Application Development

Android Application Development Android Application Development Octav Chipara What is Android A free, open source mobile platform A Linux-based, multiprocess, multithreaded OS Android is not a device or a product It s not even limited

More information

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 2 Workshop 1. Compare different layout by using Change Layout button (Page 1 5) Relative Layout Linear Layout (Horizontal) Linear Layout (Vertical) Frame Layout 2. Revision on basic programming skill - control

More information

LECTURE NOTES OF APPLICATION ACTIVITIES

LECTURE NOTES OF APPLICATION ACTIVITIES Department of Information Networks The University of Babylon LECTURE NOTES OF APPLICATION ACTIVITIES By College of Information Technology, University of Babylon, Iraq Samaher@inet.uobabylon.edu.iq The

More information

Android UI: Overview

Android UI: Overview 1 Android UI: Overview An Activity is the front end component and it can contain screens. Android screens are composed of components or screen containers and components within the containers Screen containers

More information

UNIT:2 Introduction to Android

UNIT:2 Introduction to Android UNIT:2 Introduction to Android 1 Syllabus 2.1 Overview of Android 2.2 What does Android run On Android Internals? 2.3 Android for mobile apps development 2.5 Environment setup for Android apps Development

More information

Android Programs Day 5

Android Programs Day 5 Android Programs Day 5 //Android Program to demonstrate the working of Options Menu. 1. Create a New Project. 2. Write the necessary codes in the MainActivity.java to create OptionMenu. 3. Add the oncreateoptionsmenu()

More information

Building User Interface for Android Mobile Applications II

Building User Interface for Android Mobile Applications II Building User Interface for Android Mobile Applications II Mobile App Development 1 MVC 2 MVC 1 MVC 2 MVC Android redraw View invalidate Controller tap, key pressed update Model MVC MVC in Android View

More information

Mobila applikationer och trådlösa nät, HI1033, HT2012

Mobila applikationer och trådlösa nät, HI1033, HT2012 Mobila applikationer och trådlösa nät, HI1033, HT2012 Today: - User Interface basics - View components - Event driven applications and callbacks - Menu and Context Menu - ListView and Adapters - Android

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 2 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 1 -recap What is Android How to develop Android applications Run & debug the applications

More information

BCA 6. Question Bank

BCA 6. Question Bank BCA 6 030010601 : Introduction to Mobile Application Development Question Bank Unit 1: Introduction to Android and Development tools Short questions 1. What kind of tool is used to simulate Android application?

More information

MOBILE OPERATING SYSTEM

MOBILE OPERATING SYSTEM MOBILE OPERATING SYSTEM 1 Raghav Arora, 2 Rana Rahul Sathyaprakash, 3 Saurabh Rauthan, 4 Shrey Jakhetia 1,2,3,4 Student, Department of Computer Science & Engineering, Dronacharya College of Engineering,

More information

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH

Android Basics. - Bhaumik Shukla Android Application STEALTH FLASH Android Basics - Bhaumik Shukla Android Application Developer @ STEALTH FLASH Introduction to Android Android is a software stack for mobile devices that includes an operating system, middleware and key

More information

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING

MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING This document can be downloaded from www.chetanahegde.in with most recent updates. 1 MODULE 2: GETTING STARTED WITH ANDROID PROGRAMMING Syllabus: What is Android? Obtaining the required tools, Anatomy

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Android Lifecycle An activity begins its lifecycle when entering the oncreate() state If not

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming. Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 2: Introduction to Android Programming Emmanuel Agu Android Apps: Big Picture UI Design using XML UI design code (XML) separate from the program (Java) Why?

More information

Mobila applikationer och trådlösa nät, HI1033, HT2013

Mobila applikationer och trådlösa nät, HI1033, HT2013 Mobila applikationer och trådlösa nät, HI1033, HT2013 Today: - User Interface basics - View components - Event driven applications and callbacks - Menu and Context Menu - ListView and Adapters - Android

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Entire Lifetime An activity begins its lifecycle when entering the oncreate() state If not interrupted

More information

Android Basics. Android UI Architecture. Android UI 1

Android Basics. Android UI Architecture. Android UI 1 Android Basics Android UI Architecture Android UI 1 Android Design Constraints Limited resources like memory, processing, battery à Android stops your app when not in use Primarily touch interaction à

More information

User Interface Design & Development

User Interface Design & Development User Interface Design & Development Lecture Intro to Android João Pedro Sousa SWE 632, Fall 2011 George Mason University features multitasking w/ just-in-time compiler for Dalvik-VM bytecode storage on

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming. Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2a: Introduction to Android Programming Emmanuel Agu Editting in Android Studio Recall: Editting Android Can edit apps in: Text View: edit XML directly Design

More information

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license Android Android Mobile operating system developed by Google A complete stack OS, framework A rich set of applications Email, calendar, browser, maps, text messaging, contacts, camera, dialer, music player,

More information

Praktikum Entwicklung Mediensysteme. Implementing a User Interface

Praktikum Entwicklung Mediensysteme. Implementing a User Interface Praktikum Entwicklung Mediensysteme Implementing a User Interface Outline Introduction Programmatic vs. XML Layout Common Layout Objects Hooking into a Screen Element Listening for UI Notifications Applying

More information

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control.

TextView Control. EditText Control. TextView Attributes. android:id - This is the ID which uniquely identifies the control. A TextView displays text to the user. TextView Attributes TextView Control android:id - This is the ID which uniquely identifies the control. android:capitalize - If set, specifies that this TextView has

More information

Activities and Fragments

Activities and Fragments Activities and Fragments 21 November 2017 Lecture 5 21 Nov 2017 SE 435: Development in the Android Environment 1 Topics for Today Activities UI Design and handlers Fragments Source: developer.android.com

More information

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology Android App Development Mr. Michaud ICE Programs Georgia Institute of Technology Android Operating System Created by Android, Inc. Bought by Google in 2005. First Android Device released in 2008 Based

More information

Fragment Example Create the following files and test the application on emulator or device.

Fragment Example Create the following files and test the application on emulator or device. Fragment Example Create the following files and test the application on emulator or device. File: AndroidManifest.xml

More information

Statistics http://www.statista.com/topics/840/smartphones/ http://www.statista.com/topics/876/android/ http://www.statista.com/statistics/271774/share-of-android-platforms-on-mobile-devices-with-android-os/

More information

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples. Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 2a: Android UI Design in XML + Examples Emmanuel Agu Android UI Design in XML Recall: Files Hello World Android Project XML file used to design Android UI

More information

Android Overview. Most of the material in this section comes from

Android Overview. Most of the material in this section comes from Android Overview Most of the material in this section comes from http://developer.android.com/guide/ Android Overview A software stack for mobile devices Developed and managed by Open Handset Alliance

More information

CS 4330/5390: Mobile Application Development Exam 1

CS 4330/5390: Mobile Application Development Exam 1 1 Spring 2017 (Thursday, March 9) Name: CS 4330/5390: Mobile Application Development Exam 1 This test has 8 questions and pages numbered 1 through 7. Reminders This test is closed-notes and closed-book.

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Tip: Switching UIs THE PROBLEM How to switch from one UI to another Each UI is associated with a distinct class that controls it Solution shown: two UIs,

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Managing Screen Orientation EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Managing Screen Orientation ORIENTATIONS Portrait Landscape Reverse portrait Reverse landscape ON REVERSE PORTRAIT Android: all four orientations are

More information

Produced by. Mobile Application Development. Eamonn de Leastar

Produced by. Mobile Application Development. Eamonn de Leastar Mobile Application Development Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie A First

More information

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 3 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MainActivity.java File package com.example.tutorialspoint; import android.manifest;

More information

Android UI Development

Android UI Development Android UI Development Android UI Studio Widget Layout Android UI 1 Building Applications A typical application will include: Activities - MainActivity as your entry point - Possibly other activities (corresponding

More information

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 4. Workshop

Android Apps Development for Mobile and Tablet Device (Level I) Lesson 4. Workshop Workshop 1. Create an Option Menu, and convert it into Action Bar (Page 1 8) Create an simple Option Menu Convert Option Menu into Action Bar Create Event Listener for Menu and Action Bar Add System Icon

More information

Chapter 1 Hello, Android

Chapter 1 Hello, Android Chapter 1 Hello, Android OPEN HANDSET ALLIANCE OPEN HANDSET ALLIANCE OPEN HANDSET ALLIANCE A commitment to openness, a shared vision for the future, and concrete plans to make the vision a reality. To

More information

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners Layouts and Views http://developer.android.com/guide/topics/ui/declaring-layout.html http://developer.android.com/reference/android/view/view.html Repo: https://github.com/karlmorris/viewsandlayouts Overview

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Saving State EMBEDDED SYSTEMS PROGRAMMING 2016-17 Application Tip: Saving State THE PROBLEM How to save the state (of a UI, for instance) so that it survives even when the application is closed/killed The state should

More information

Real-Time Embedded Systems

Real-Time Embedded Systems Real-Time Embedded Systems DT8025, Fall 2016 http://goo.gl/azfc9l Lecture 8 Masoumeh Taromirad m.taromirad@hh.se Center for Research on Embedded Systems School of Information Technology 1 / 51 Smart phones

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

COPYRIGHTED MATERIAL. 1Getting Started with Android Programming

COPYRIGHTED MATERIAL. 1Getting Started with Android Programming 1Getting Started with Android Programming WHAT YOU WILL LEARN IN THIS CHAPTER What is Android? Android versions and its feature set The Android architecture The various Android devices on the market The

More information

Create Parent Activity and pass its information to Child Activity using Intents.

Create Parent Activity and pass its information to Child Activity using Intents. Create Parent Activity and pass its information to Child Activity using Intents. /* MainActivity.java */ package com.example.first; import android.os.bundle; import android.app.activity; import android.view.menu;

More information

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml Android Application Written in Java (it s possible to write native code) Good

More information

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities Activities Ref: Wei-Meng Lee, BEGINNING ANDROID 4 APPLICATION DEVELOPMENT, Ch2, John Wiley & Sons, 2012 An application can have zero or more activities. Typically, applications have one or more activities;

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 8 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

More information

Android Programming (5 Days)

Android Programming (5 Days) www.peaklearningllc.com Android Programming (5 Days) Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse tools. This Android

More information

Android. Operating System and Architecture. Android. Screens. Main features

Android. Operating System and Architecture. Android. Screens. Main features Android Android Operating System and Architecture Operating System and development system from Google and Open Handset Alliance since 2008 At the lower level is based on the Linux kernel and in a higher

More information

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment FRAGMENTS Fragments An activity is a container for views When you have a larger screen device than a phone like a tablet it can look too simple to use phone interface here. Fragments Mini-activities, each

More information

CS 528 Mobile and Ubiquitous Computing Lecture 3: Android UI, WebView, Android Activity Lifecycle Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 3: Android UI, WebView, Android Activity Lifecycle Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 3: Android UI, WebView, Android Activity Lifecycle Emmanuel Agu Android UI Design Example GeoQuiz App Reference: Android Nerd Ranch, pgs 1 30 App presents

More information

Programming Android UI. J. Serrat Software Design December 2017

Programming Android UI. J. Serrat Software Design December 2017 Programming Android UI J. Serrat Software Design December 2017 Preliminaries : Goals Introduce basic programming Android concepts Examine code for some simple examples Limited to those relevant for the

More information

Lampiran Program : Res - Layout Activity_main.xml

More information

Beginning Android 4 Application Development

Beginning Android 4 Application Development Beginning Android 4 Application Development Lee, Wei-Meng ISBN-13: 9781118199541 Table of Contents INTRODUCTION xxi CHAPTER 1: GETTING STARTED WITH ANDROID PROGRAMMING 1 What Is Android? 2 Android Versions

More information

MOBILE COMPUTING 1/20/18. How many of you. CSE 40814/60814 Spring have implemented a command-line user interface?

MOBILE COMPUTING 1/20/18. How many of you. CSE 40814/60814 Spring have implemented a command-line user interface? MOBILE COMPUTING CSE 40814/60814 Spring 2018 How many of you have implemented a command-line user interface? How many of you have implemented a graphical user interface? HTML/CSS Java Swing.NET Framework

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

Fragments. Lecture 11

Fragments. Lecture 11 Fragments Lecture 11 Situational layouts Your app can use different layouts in different situations Different device type (tablet vs. phone vs. watch) Different screen size Different orientation (portrait

More information

Adapter.

Adapter. 1 Adapter An Adapter object acts as a bridge between an AdapterView and the underlying data for that view The Adapter provides access to the data items The Adapter is also responsible for making a View

More information

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters Mobile Programming Lecture 5 Composite Views, Activities, Intents and Filters Lecture 4 Review How do you get the value of a string in the strings.xml file? What are the steps to populate a Spinner or

More information

Computer Science E-76 Building Mobile Applications

Computer Science E-76 Building Mobile Applications Computer Science E-76 Building Mobile Applications Lecture 3: [Android] The SDK, Activities, and Views February 13, 2012 Dan Armendariz danallan@mit.edu 1 http://developer.android.com Android SDK and NDK

More information

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011 Android for Ubiquitous Computing Researchers Andrew Rice University of Cambridge 17-Sep-2011 Getting started Website for the tutorial: http://www.cl.cam.ac.uk/~acr31/ubicomp/ Contains links to downloads

More information

1. Simple List. 1.1 Simple List using simple_list_item_1

1. Simple List. 1.1 Simple List using simple_list_item_1 1. Simple List 1.1 Simple List using simple_list_item_1 1. Create the Android application with the following attributes. Application Name: MySimpleList Project Name: Package Name: MySimpleList com.example.mysimplelist

More information

ANDROID PROGRAMS DAY 3

ANDROID PROGRAMS DAY 3 ANDROID PROGRAMS DAY 3 //Android project to navigate from first page to second page using Intent Step 1: Create a new project Step 2: Enter necessary details while creating project. Step 3: Drag and drop

More information

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering Getting Started Dr. Miguel A. Labrador Department of Computer Science & Engineering labrador@csee.usf.edu http://www.csee.usf.edu/~labrador 1 Goals Setting up your development environment Android Framework

More information

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

Programming with Android: Layouts, Widgets and Events. Dipartimento di Scienze dell Informazione Università di Bologna

Programming with Android: Layouts, Widgets and Events. Dipartimento di Scienze dell Informazione Università di Bologna Programming with Android: Layouts, Widgets and Events Luca Bedogni Marco Di Felice Dipartimento di Scienze dell Informazione Università di Bologna Outline Components of an Activity ViewGroup: definition

More information

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L 2 0 1 5 Activity Basics Manifest File AndroidManifest.xml Central configuration of Android application Defines: Name of application Icon for

More information

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie Android Anatomy Android Anatomy 2! Agenda

More information

Mobile Computing. Introduction to Android

Mobile Computing. Introduction to Android Mobile Computing Introduction to Android Mobile Computing 2011/2012 What is Android? Open-source software stack for mobile devices OS, middleware and key applications Based upon a modified version of the

More information

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial

Hello World. Lesson 1. Android Developer Fundamentals. Android Developer Fundamentals. Layouts, and. NonCommercial Hello World Lesson 1 This work is licensed This under work a Creative is is licensed Commons under a a Attribution-NonCommercial Creative 4.0 Commons International Attribution- License 1 NonCommercial

More information

Vienos veiklos būsena. Theory

Vienos veiklos būsena. Theory Vienos veiklos būsena Theory While application is running, we create new Activities and close old ones, hide the application and open it again and so on, and Activity can process all these events. It is

More information

Introduction to Android Development

Introduction to Android Development Introduction to Android Development What is Android? Android is the customizable, easy to use operating system that powers more than a billion devices across the globe - from phones and tablets to watches,

More information

Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time

Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time The 1 activity 1 thing the user can do heuristic may not make sense for larger devices Application

More information

Lab 1: Getting Started With Android Programming

Lab 1: Getting Started With Android Programming Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Eng. Jehad Aldahdooh Mobile Computing Android Lab Lab 1: Getting Started With Android Programming To create a new Android Project

More information

ANDROID APPS DEVELOPMENT FOR MOBILE GAME

ANDROID APPS DEVELOPMENT FOR MOBILE GAME ANDROID APPS DEVELOPMENT FOR MOBILE GAME Application Components Hold the content of a message (E.g. convey a request for an activity to present an image) Lecture 2: Android Layout and Permission Present

More information

Chapter 8 Positioning with Layouts

Chapter 8 Positioning with Layouts Introduction to Android Application Development, Android Essentials, Fifth Edition Chapter 8 Positioning with Layouts Chapter 8 Overview Create user interfaces in Android by defining resource files or

More information

FRAGMENTS.

FRAGMENTS. Fragments 69 FRAGMENTS In the previous section you learned what an activity is and how to use it. In a small-screen device (such as a smartphone), an activity typically fi lls the entire screen, displaying

More information

Mobile User Interfaces

Mobile User Interfaces Mobile User Interfaces CS 2046 Mobile Application Development Fall 2010 Announcements Next class = Lab session: Upson B7 Office Hours (starting 10/25): Me: MW 1:15-2:15 PM, Upson 360 Jae (TA): F 11:00

More information

Android Application Development. By : Shibaji Debnath

Android Application Development. By : Shibaji Debnath Android Application Development By : Shibaji Debnath About Me I have over 10 years experience in IT Industry. I have started my career as Java Software Developer. I worked in various multinational company.

More information

14.1 Overview of Android

14.1 Overview of Android 14.1 Overview of Android - Blackberry smart phone appeared in 2003 First widely used mobile access to the Web - Smart phone market now dominated by Android, iphone, and Windows Phone - Tablets are now

More information

Mobile Computing Practice # 2c Android Applications - Interface

Mobile Computing Practice # 2c Android Applications - Interface Mobile Computing Practice # 2c Android Applications - Interface One more step in the restaurants application. 1. Design an alternative layout for showing up in landscape mode. Our current layout is not

More information

CS260 Intro to Java & Android 05.Android UI(Part I)

CS260 Intro to Java & Android 05.Android UI(Part I) CS260 Intro to Java & Android 05.Android UI(Part I) Winter 2018 Winter 2018 CS250 - Intro to Java & Android 1 User Interface UIs in Android are built using View and ViewGroup objects A View is the base

More information

Android Development Tutorial. Yi Huang

Android Development Tutorial. Yi Huang Android Development Tutorial Yi Huang Contents What s Android Android architecture Android software development Hello World on Android More 2 3 What s Android Android Phones Sony X10 HTC G1 Samsung i7500

More information

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle CS378 - Mobile Computing Anatomy of an Android App and the App Lifecycle Application Components five primary components different purposes and different lifecycles Activity single screen with a user interface,

More information

MC Android Programming

MC Android Programming MC1921 - Android Programming Duration: 5 days Course Price: $3,395 Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse

More information

GUI Widget. Lecture6

GUI Widget. Lecture6 GUI Widget Lecture6 AnalogClock/Digital Clock Button CheckBox DatePicker EditText Gallery ImageView/Button MapView ProgressBar RadioButton Spinner TextView TimePicker WebView Android Widgets Designing

More information

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi Introduction An application is composed of at least one Activity GUI It is a software component that stays behind a GUI (screen) Activity It runs inside the

More information

Android Software Development Kit (Part I)

Android Software Development Kit (Part I) Android Software Development Kit (Part I) Gustavo Alberto Rovelo Ruiz October 29th, 2010 Look & Touch Group 2 Presentation index What is Android? Android History Stats Why Andriod? Android Architecture

More information

Comparative Study on Layout and Drawable Resource Behavior in Android for Supporting Multi Screen

Comparative Study on Layout and Drawable Resource Behavior in Android for Supporting Multi Screen International Journal of Innovative Research in Computer Science & Technology (IJIRCST) ISSN: 2347-5552, Volume 2, Issue 3, May - 2014 Comparative Study on Layout and Drawable Resource Behavior in Android

More information

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015

CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 CSE 660 Lab 3 Khoi Pham Thanh Ho April 19 th, 2015 Comment and Evaluation: This lab introduces us about Android SDK and how to write a program for Android platform. The calculator is pretty easy, everything

More information

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing

More information

Programming with Android: Introduction. Layouts. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Programming with Android: Introduction. Layouts. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna Programming with Android: Introduction Layouts Luca Bedogni Marco Di Felice Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna Views: outline Main difference between a Drawable and

More information

Android Layout Types

Android Layout Types Android Layout Types Android Linear Layout Android LinearLayout is a view group that aligns all children in either vertically or horizontally. android:divider - This is drawable to use as a vertical divider

More information

UI Fragment.

UI Fragment. UI Fragment 1 Contents Fragments Overviews Lifecycle of Fragments Creating Fragments Fragment Manager and Transactions Adding Fragment to Activity Fragment-to-Fragment Communication Fragment SubClasses

More information