Mobile Programming Lecture 3. Resources, Selection, Activities, Intents

Size: px
Start display at page:

Download "Mobile Programming Lecture 3. Resources, Selection, Activities, Intents"

Transcription

1 Mobile Programming Lecture 3 Resources, Selection, Activities, Intents

2 Lecture 2 Review What widget would you use to allow the user to enter a yes/no value a range of values from 1 to 100 What's the benefit of a TableLayout over LinearLayout? How many ways can you set an event listener?

3 Lecture 2 Review How do you make the android:inputtype attribute of an EditText both textcapwords and textmultiline? Why should you use resource for TextViews instead of hardcoding the string? If you use the same android:onclick value for multiple views, how do you determine which one was clicked?

4 Agenda resources Setters and Getters Selection Views Android Components - Activity Intents More on the Android Manifest File

5 String Resources Three types of string resources String String Array Quantity Strings

6 String Resources Three types of string resources String String Array Quantity Strings

7 String Resources - String Used to store a single string resource <string name= sample_string >Sample String</string> Referenced - in XML Resources res = getresources(); res.getstring() / gettext() //gettext() retains any text styling

8 String Resources Three types of string resources String String Array Quantity Strings

9 String Resources - String Array Used to provide an array of strings <string-array name= array_name > <item>item 1</item> <item>item 2</item> <item>item 3</item> </string-array> Referenced in XML Resources res = getresources(); res.getstringarray();

10 String Resources Three types of string resources String String Array Quantity Strings

11 String Resources - Quantity Strings Used to provide different string outputs for plurals <plurals name= plural_name > <item quantity= one >%d student has an A</item> <item quantity= other >%d students have an A</item> </plurals> Referenced using: Resource res = getresources(); res.getquantitystring(r.plurals.plural_name, count, count);

12 Resources Resources are stored in res/values/strings.xml You reference them in XML as

13 Resources You can also reference them in Java String buttontext = ""; Resources res = getresources(); buttontext = res.getstring(r.string.string_name);

14 Referencing Resources You can store an array of strings if you need a collection instead of just a single string. This makes it resource instead resource! Open res/values/strings.xml and create the new entry You can also get some assistance by Right-click the body of the strings.xml file Select Generate > XML Tag Select the appropriate resource type (string-array) Provide your resource with a name, e.g. "countries" Add an <item> entry for each item in the array

15 Setters and Getters for Views Most of a View's attributes can be set and get programmatically Example widget XML attribute set method get method EditText android:text settext(string) gettext() Button android:onclick setonclicklistener( OnClickListener) - CheckBox android:checked setchecked(boolean) ischecked() SeekBar android:progress setprogress(int) getprogress() SeekBar android:max setmax(int) getmax()

16 Selection Widgets - Spinner Similar to a drop-down list android:spinnermode "dialog" or "dropdown" android:prompt e.g. "Select an option" message to display when the spinner dialog is shown only when android:spinnermode="dialog" android:entries e.g. "@array/countries" populate the spinner using this array

17 Selection Widgets - Spinner Similar to a drop-down list android:prompt e.g. "Select If the list is static, an option" you message can again to display avoid Java when the spinner dialog is shown by specifying the android:spinnermode "dialog" or "dropdown" android:entries entries in XML! e.g. "@array/countries" populate the spinner using this array

18 Selection Widgets - Spinner Similar to a drop-down list android:prompt e.g. "Select an option" message to display when the spinner dialog is shown android:spinnermode you can set the entries "dialog" or "dropdown" android:entries If you don't like XML, in Java also. e.g. "@array/countries" populate the spinner using this array

19 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

20 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); This is the Java code. If you choose to do this, then you don't need to set the android:entries attribute ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

21 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); You should already know what this does. setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

22 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Since you don't like XML, to do it programmatically, you need to use an Adapter. Spinner spinner = (Spinner) findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

23 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); This is Java stuff. If you don't know what it is, try Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); removing it to see what happens. ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

24 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) If you have resource already, then create an ArrayAdapter from that resource. findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

25 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> adapter = First argument is of type Context, you can just pass the "this" keyword here (because of the state of app) ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

26 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); This is the resource that you're creating the ArrayAdapter<CharSequence> from. adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

27 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> 3rd argument expects adapter = of a TextView. ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

28 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); android.r gives you ArrayAdapter<CharSequence> resources that exist for adapter = use even before you ArrayAdapter.createFromResource(this, your app R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

29 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); So instead of creating and using your own TextView for this ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, purpose, use this one R.array.countries, android.r.layout.simple_spinner_item); myspinner.setadapter(adapter);

30 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); Attach the Adapter to the Spinner in order to populate the Spinner! myspinner.setadapter(adapter);

31 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); ArrayAdapter<CharSequence> adapter = Finally, this line of code is not required, but it makes your drop down look pretty. ArrayAdapter.createFromResource(this, R.array.countries, android.r.layout.simple_spinner_item); adapter.setdropdownviewresource (android.r.layout.simple_spinner_dropdown_item); myspinner.setadapter(adapter);

32 Selection Widgets - Spinner Both ways give you a Spinner which uses predetermined entries How do you populate the Spinner at runtime, when the entries are also determined at runtime?

33 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); String[] countries = new String[]{ "Brazil", "China", "Denmark" ; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.r.layout.simple_spinner_item, countries); myspinner.setadapter(adapter);

34 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Create and initialize a String array Spinner spinner = (Spinner) findviewbyid(r.id.my_spinner); String[] countries = new String[] { "Brazil", "China", "Denmark" ; ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.r.layout.simple_spinner_item, countries); myspinner.setadapter(adapter);

35 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); String[] countries = new String[] { "Brazil", "China", Create an ArrayAdapter to populate "Denmark"; the Spinner with ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.r.layout.simple_spinner_item, countries); myspinner.setadapter(adapter);

36 Selection Widgets - Spinner public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); Spinner myspinner = (Spinner) findviewbyid(r.id.my_spinner); String[] countries = new String[] { "Brazil", "China", "Denmark" ; 3rd argument accepts a List of Strings ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.r.layout.simple_spinner_item, countries); myspinner.setadapter(adapter);

37 Selection Widgets - ListView A ListView is similar to a Spinner They both show the user a list of items They both have the android:entries attribute, so they can both be set using the resource or the same ArrayAdapter

38 Selection Widgets - ListView A ListView is similar to a Spinner with some exceptions, to name a few: A Spinner is normally used for forms, a ListView not so much A Spinner only shows one item at a time A Spinner item can be "selected", a ListView item can be "clicked" or "selected"

39 Selection Widgets - ListView A ListView is similar to a Spinner with some exceptions, to name a few: A Spinner is normally used for forms, a ListView not This was added in so much hindsight. On A Spinner only non-touch-screen shows one devices item at a time can be selected A Spinner item can be "selected", a ListView item can be "clicked" or "selected"

40 Events - Spinner OnItemSelected You can set an EventListener for when the user selects an item from the Spinner

41 Events - Spinner OnItemSelected myspinner.setonitemselectedlistener(new OnItemSelectedListener() public void onitemselected(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

42 Events Setter - method Spinner for OnItemSelected setting the EventListener myspinner.setonitemselectedlistener(new OnItemSelectedListener() public void onitemselected(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

43 Events - Spinner OnItemSelected Anonymous class myspinner.setonitemselectedlistener(new OnItemSelectedListener() public void onitemselected(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

44 Events - Spinner OnItemSelected When an item is myspinner.setonitemselectedlistener(new selected..., OnItemSelectedListener() public void onitemselected(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

45 Events - Spinner OnItemSelected You can now reference the actual View (i.e., myspinner.setonitemselectedlistener(new OnItemSelectedListener() each entry in Spinner { is a public void onitemselected(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

46 Events - Spinner OnItemSelected myspinner.setonitemselectedlistener(new OnItemSelectedListener() { The position of the in the Adapter public void onitemselected(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

47 Events - Spinner OnItemSelected myspinner.setonitemselectedlistener(new The android:id attribute OnItemSelectedListener() of the view public void onitemselected(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

48 Events - Spinner OnItemSelected myspinner.setonitemselectedlistener(new OnItemSelectedListener() public void onitemselected(adapterview<?> parent, View view, Cast the generic View int position, to long a TextView id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

49 Events - Spinner OnItemSelected myspinner.setonitemselectedlistener(new OnItemSelectedListener() public void onitemselected(adapterview<?> Get the android:text parent, View view, int position, long id) { value Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public void onnothingselected(adapterview<?> parent) { Toast.makeText(getApplicationContext(), "You didn't select anything", Toast.LENGTH_SHORT).show();

50 Events - Spinner OnItemSelected Note that we're using OnItemSelectedListener instead of OnItemClickListener for Spinner! If you try to use OnItemClickListener you may get errors Also, note the difference between these two listeners and OnClickListener OnItemClickListener an entry in the Spinner has been clicked, don't use this OnClickListener the Spinner has been clicked OnItemSelectedListener an entry in the Spinner has been selected

51 Events - ListView OnItemClick As mentioned before, a ListView item can be clicked, or selected In that case, you use OnItemClickListener or OnItemSelectedListener

52 Events - ListView OnItemClick mylistview.setonitemclicklistener(new OnItemClickListener() public void onitemclick(adapterview<?> parent, View view, int position, long id) { Toast.makeText(getApplicationContext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); );

53 Android Application Components So far we've only been working with 1 of the 4 Android components, namely Activity

54 Android Application Components The 4 Android application components are 1. Activity 2. Broadcast Receiver 3. Content Provider 4. Service

55 Android Application Components 1. Activity 2. Broadcast Receiver 3. Content Provider 4. Service

56 Activity So far we've only been working with a single Activity Remember, an Activity is a single screen with a user interface Each Activity in an application is independent

57 Activity An Activity is the only Android application component with a UI!

58 Activity In Homework 2, you're creating a form that doesn't do anything after the form is submitted If you want to take the user to a different screen after the form is submitted, you should add a new Activity to your app

59 Activity To add a new Activity Right-click your project and choose New > Activity Select an Activity template, provide a name for the Layout Resource file and provide any other necessary information Click Finish Or Create a new Java class that extends the Activity base class Open the AndroidManifest.xml file Add a new <activity> tag and configure the appropriate attributes Save the AndroidManifest.xml file

60 Activity You can design the UI for your second Activity as well e.g. add another res/layout/xml_file.xml Now we need to figure out how to launch the second Activity B from the first Activity A

61 Intent An Intent is an abstract description of an operation to be performed You can use an Intent to launch another Activity B from within Activity A

62 Activity and Intent... public void onclick(view view) { Intent myintent = new Intent(A.this, B.class); startactivity(intent);...

63 Activity and Intent... public void onclick(view view) { Intent myintent = new Intent(A.this, B.class); startactivity(myintent); The name of the Activity the app is currently running...

64 Activity and Intent... public void onclick(view view) The name of the Activity { that should be launched Intent myintent = new Intent(A.this, B.class); startactivity(myintent);...

65 Activity and Intent... public void onclick(view view) { Intent Launch Activity B myintent now = new Intent(A.this, B.class); startactivity(myintent);...

66 Activity - Android Manifest File If you added the second Activity B using the wizard/template, then B will be automatically added to the Android Manifest file If you added it manually, then Activity B may not be in the Manifest File. This is an easy to get a Force Close when you try to launch Activity B! Android needs to know what Activities your app may launch

67 Activity - ListActivity Sometimes the entire UI for your Activity may be a ListView In this case, you can extend ListActivity instead of extending Activity You don't need a layout.xml file for a ListActivity!

68 Activity - ListActivity public class MyListActivity extends ListActivity public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); String[] list = new String[] { "one", "two", "three" ; ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.r.layout.simple_list_item_1, list); setlistadapter(adapter);

69 Activity - ListActivity extend ListActivity instead of Activity public class MyListActivity extends ListActivity public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); String[] list = new String[]{"one","two","three"; ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.r.layout.simple_list_item_1, list); setlistadapter(adapter);

70 Activity - ListActivity public class MyListActivity extends ListActivity public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); We don't need to setcontentview because we're String[] list = new String[]{"one","two","three"; extending ListActivity ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.r.layout.simple_list_item_1, list); setlistadapter(adapter);

71 Activity - ListActivity public class MyListActivity extends ListActivity public void oncreate(bundle savedinstancestate) { We've seen this before in this lecture super.oncreate(savedinstancestate); String[] list = new String[] { "Brazil", "China", "Denmark"; ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.r.layout.simple_list_item_1, list); setlistadapter(adapter);

72 Activity - ListActivity public class MyListActivity extends ListActivity public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); We've also seen this before in this lecture String[] list = new String[]{ "Brazil", "China", "Denmark"; ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.r.layout.simple_list_item_1, list); setlistadapter(adapter);

73 Activity - ListActivity public class MyListActivity extends ListActivity public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); String[] list = new String[] { "Brazil", "China", "Denmark"; ArrayAdapter<CharSequence> adapter = We call setlistadapter on this ListActivity instead of calling it on a ListView (we don't have a ListView specified in an XML file this time!) new ArrayAdapter<CharSequence>(this, android.r.layout.simple_list_item_1, list); setlistadapter(adapter);

74 Activity - ListActivity public class MyListActivity extends ListActivity public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); String[] list = new String[] { "Brazil", "China", "Denmark"; ArrayAdapter<CharSequence> adapter = This is equivalent to calling this.setlistadapter(adapter); i.e., using the this keyword to refer to this instance of MyListActivity new ArrayAdapter<CharSequence>(this, android.r.layout.simple_list_item_1, list); setlistadapter(adapter);

75 References The Busy Coder's Guide to Android Development - Mark Murphy Android Developers The Mobile Lab at Florida State University

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

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling

Mobile Programming Lecture 2. Layouts, Widgets, Toasts, and Event Handling Mobile Programming Lecture 2 Layouts, Widgets, Toasts, and Event Handling Lecture 1 Review How to edit XML files in Android Studio? What holds all elements (Views) that appear to the user in an Activity?

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu India Summer 2012 Review Session Android and Web Working with Views Working with Views Create a new Android project. The app name should

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

ListView Containers. Resources. Creating a ListView

ListView Containers. Resources. Creating a ListView ListView Containers Resources https://developer.android.com/guide/topics/ui/layout/listview.html https://developer.android.com/reference/android/widget/listview.html Creating a ListView A ListView is a

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

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

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

Android writing files to the external storage device

Android writing files to the external storage device Android writing files to the external storage device The external storage area is what Android knows as the SD card. There is a virtual SD card within the Android file system although this may be of size

More information

Introductory Mobile App Development

Introductory Mobile App Development Introductory Mobile App Development 152-160 Quick Links & Text References Overview Pages ListView Pages ArrayAdaper Pages Filling a ListView Pages Sensing Click Pages Selected Item Info Pages Configuring

More information

INTRODUCTION COS MOBILE DEVELOPMENT WHAT IS ANDROID CORE OS. 6-Android Basics.key - February 21, Linux-based.

INTRODUCTION COS MOBILE DEVELOPMENT WHAT IS ANDROID CORE OS. 6-Android Basics.key - February 21, Linux-based. 1 COS 470 - MOBILE DEVELOPMENT INTRODUCTION 2 WHAT IS ANDROID Linux-based Java/Kotlin Android Runtime (ART) System Apps SMS, Calendar, etc. Platform Architecture 3 CORE OS Linux (64 bit) Each app is a

More information

Adapting to Data. Before we get to the fun stuff... Initial setup

Adapting to Data. Before we get to the fun stuff... Initial setup Adapting to Data So far, we've mostly been sticking with a recurring theme: visual elements are tied to XML-defined resources, not programmatic creation or management. But that won't always be the case.

More information

Creating a Custom ListView

Creating a Custom ListView Creating a Custom ListView References https://developer.android.com/guide/topics/ui/declaring-layout.html#adapterviews Overview The ListView in the previous tutorial creates a TextView object for each

More information

Practical 1.ListView example

Practical 1.ListView example Practical 1.ListView example In this example, we show you how to display a list of fruit name via ListView. Android Layout file File : res/layout/list_fruit.xml

More information

Mobile Programming Lecture 4. Debugging

Mobile Programming Lecture 4. Debugging Mobile Programming Lecture 4 Debugging Lecture 2 Review How do you make the android:inputtype attribute of an EditText both textcapwords and textmultiline? Why should you use a @string resource for TextViews

More information

ListView (link) An ordered collection of selectable choices. key attributes in XML:

ListView (link) An ordered collection of selectable choices. key attributes in XML: CS 193A Lists This document is copyright (C) Marty Stepp and Stanford Computer Science. Licensed under Creative Commons Attribution 2.5 License. All rights reserved. ListView (link) An ordered collection

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

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 Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9)

Android Specifics. Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics Jonathan Diehl (Informatik 10) Hendrik Thüs (Informatik 9) Android Specifics ArrayAdapter Preferences Widgets Jonathan Diehl, Hendrik Thüs 2 ArrayAdapter Jonathan Diehl, Hendrik Thüs

More information

Mobile Programming Lecture 7. Dialogs, Menus, and SharedPreferences

Mobile Programming Lecture 7. Dialogs, Menus, and SharedPreferences Mobile Programming Lecture 7 Dialogs, Menus, and SharedPreferences Agenda Dialogs Menus SharedPreferences Android Application Components 1. Activity 2. Broadcast Receiver 3. Content Provider 4. Service

More information

(c) Dr Sonia Sail LAJMI College of Computer Sciences & IT (girl Section) 1

(c) Dr Sonia Sail LAJMI College of Computer Sciences & IT (girl Section) 1 Level 5: Baccalaureus in Computer Sciences CHAPTER 4: LAYOUTS AND VIEWS Dr. Sonia Saïd LAJMI PhD in Computer Sciences 1 Layout.xml 2 Computer Sciences & IT (girl Section) 1 Layout Requirements android:layout_width:

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

Android Programming Lecture 2 9/7/2011

Android Programming Lecture 2 9/7/2011 Android Programming Lecture 2 9/7/2011 Creating a first app 1. Create a new Android project (a collection of source code and resources for the app) from the Eclipse file menu 2. Choose a project name (can

More information

Mobile Programming Lecture 1. Getting Started

Mobile Programming Lecture 1. Getting Started Mobile Programming Lecture 1 Getting Started Today's Agenda About the Android Studio IDE Hello, World! Project Android Project Structure Introduction to Activities, Layouts, and Widgets Editing Files in

More information

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

Programming with Android: Widgets and Events. Luca Bedogni. Dipartimento di Scienze dell Informazione Università di Bologna Programming with Android: Widgets and Events Luca Bedogni Dipartimento di Scienze dell Informazione Università di Bologna Outline What is a Widget? Widget: TextView and EditText Widget: Button and CompoundButton

More information

TextView. A label is called a TextView. TextViews are typically used to display a caption TextViews are not editable, therefore they take no input

TextView. A label is called a TextView. TextViews are typically used to display a caption TextViews are not editable, therefore they take no input 1 UI Components 2 UI Components 3 A label is called a TextView. TextView TextViews are typically used to display a caption TextViews are not editable, therefore they take no input - - - - - - -

More information

More Effective Layouts

More Effective Layouts More Effective Layouts In past weeks, we've looked at ways to make more effective use of the presented display (e.g. elastic layouts, and separate layouts for portrait and landscape), as well as autogenerating

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 The image cannot be displayed. Your computer

More information

CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 4: WebView (Part 2) Emmanuel Agu WebView Widget WebView Widget A View that displays web pages Can be used for creating your own web browser OR just display

More information

Developed and taught by well-known Contact author and developer. At public for details venues or onsite at your location.

Developed and taught by well-known Contact author and developer. At public for details venues or onsite at your location. 2011 Marty Hall Android Programming Basics Originals of Slides and Source Code for Examples: http://www.coreservlets.com/android-tutorial/ Customized Java EE Training: http://courses.coreservlets.com/

More information

CS371m - Mobile Computing. User Interface Basics

CS371m - Mobile Computing. User Interface Basics CS371m - Mobile Computing User Interface Basics Clicker Question Have you ever implemented a Graphical User Interface (GUI) as part of a program? A. Yes, in another class. B. Yes, at a job or internship.

More information

When programming in groups of people, it s essential to version the code. One of the most popular versioning tools is git. Some benefits of git are:

When programming in groups of people, it s essential to version the code. One of the most popular versioning tools is git. Some benefits of git are: ETSN05, Fall 2017, Version 1.0 Software Development of Large Systems Lab 2 preparations Read through this document carefully. In order to pass lab 2, you will need to understand the topics presented in

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

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

User Interface: Layout. Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University

User Interface: Layout. Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University User Interface: Layout Asst. Prof. Dr. Kanda Runapongsa Saikaew Computer Engineering Khon Kaen University http://twitter.com/krunapon Agenda User Interface Declaring Layout Common Layouts User Interface

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

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

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

THE CATHOLIC UNIVERSITY OF EASTERN AFRICA A. M. E. C. E. A

THE CATHOLIC UNIVERSITY OF EASTERN AFRICA A. M. E. C. E. A THE CATHOLIC UNIVERSITY OF EASTERN AFRICA A. M. E. C. E. A MAIN EXAMINATION P.O. Box 62157 00200 Nairobi - KENYA Telephone: 891601-6 Fax: 254-20-891084 E-mail:academics@cuea.edu AUGUST - DECEMBER 2016

More information

ES E 3 3 L a L b 5 Android development

ES E 3 3 L a L b 5 Android development ES3 Lab 5 Android development This Lab Create a simple Android interface Use XML interface layouts Access the filesystem Play media files Info about Android development can be found at http://developer.android.com/index.html

More information

The Suggest Example layout (cont ed)

The Suggest Example layout (cont ed) Using Web Services 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 7: Working with Web Services Android provides a full set of Java-standard networking APIs, such as the java.net package containing among

More information

Developing Android Applications Introduction to Software Engineering Fall Updated 1st November 2015

Developing Android Applications Introduction to Software Engineering Fall Updated 1st November 2015 Developing Android Applications Introduction to Software Engineering Fall 2015 Updated 1st November 2015 Android Lab 3 & Midterm Additional Concepts No Class Assignment 2 Class Plan Android : Additional

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

Android User Interface

Android User Interface Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 20. Oktober 2014 Outline 1 Android User Interface 2 Multi-Language Support 3 Summary Matthias Keil Android

More information

Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.

Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings. Hello World Lab Objectives: Create new Android project in Android Studio Add Button and TextView to layout Learn how to use buttons to call methods. Modify strings.xml What to Turn in: The lab evaluation

More information

South Africa Version Control.

South Africa Version Control. South Africa 2013 Lecture 7: User Interface (Navigation)+ Version Control http://aiti.mit.edu South Africa 2013 Today s agenda Recap Navigation Version Control 2 Tutorial Recap Activity 1 Activity 2 Text

More information

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard.

Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard. 44 CHAPTER 2 Android s development environment Figure 2.10 demonstrates the creation of a new project named Chapter2 using the wizard. TIP You ll want the package name of your applications to be unique

More information

Android User Interface Android Smartphone Programming. Outline University of Freiburg

Android User Interface Android Smartphone Programming. Outline University of Freiburg Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 20. Oktober 2014 Outline 1 2 Multi-Language Support 3 Summary Matthias Keil 20. Oktober 2014 2 / 19 From

More information

Upon completion of the second part of the lab the students will have:

Upon completion of the second part of the lab the students will have: ETSN05, Fall 2017, Version 2.0 Software Development of Large Systems Lab 2 1. INTRODUCTION The goal of lab 2 is to introduce students to the basics of Android development and help them to create a starting

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

INTRODUCTION TO ANDROID

INTRODUCTION TO ANDROID INTRODUCTION TO ANDROID 1 Niv Voskoboynik Ben-Gurion University Electrical and Computer Engineering Advanced computer lab 2015 2 Contents Introduction Prior learning Download and install Thread Android

More information

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming University of Babylon College of Information Technology Department of Information Networks Mobile Fundamentals and Programming Lecture 7: Data Persistence : shared preferences Lecturer : Ali Kadhim Al-Bermani

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: 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

LECTURE 08 UI AND EVENT HANDLING

LECTURE 08 UI AND EVENT HANDLING MOBILE APPLICATION DEVELOPMENT LECTURE 08 UI AND EVENT HANDLING IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM User Interface User Interface The Android Widget Toolbox 1. TextView 2. EditText 3. Spinner

More information

CMSC 436 Lab 10. App Widgets and Supporting Different Devices

CMSC 436 Lab 10. App Widgets and Supporting Different Devices CMSC 436 Lab 10 App Widgets and Supporting Different Devices Overview For this lab you will create an App Widget that uses a Configuration Activity You will also localize the widget to support different

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

CS 234/334 Lab 1: Android Jump Start

CS 234/334 Lab 1: Android Jump Start CS 234/334 Lab 1: Android Jump Start Distributed: January 7, 2014 Due: Friday, January 10 or Monday, January 13 (in-person check off in Mobile Lab, Ry 167). No late assignments. Introduction The goal of

More information

Android Workshop: Model View Controller ( MVC):

Android Workshop: Model View Controller ( MVC): Android Workshop: Android Details: Android is framework that provides java programmers the ability to control different aspects of smart devices. This interaction happens through the Android SDK (Software

More information

CMSC436: Fall 2013 Week 3 Lab

CMSC436: Fall 2013 Week 3 Lab CMSC436: Fall 2013 Week 3 Lab Objectives: Familiarize yourself with the Activity class, the Activity lifecycle, and the Android reconfiguration process. Create and monitor a simple application to observe

More information

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device 1 Software Practice 3 Today s lecture Today s Task Porting Android App. in real device Prof. Hwansoo Han T.A. Jeonghwan Park 43 INTENT 2 3 Android Intent An abstract description of a message Request actions

More information

Workshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking

Workshop. 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking Workshop 1. Create a simple Intent (Page 1 2) Launch a Camera for Photo Taking 2. Create Intent with Parsing Data (Page 3 8) Making Phone Call and Dial Access Web Content Playing YouTube Video 3. Create

More information

Solving an Android Threading Problem

Solving an Android Threading Problem Home Java News Brief Archive OCI Educational Services Solving an Android Threading Problem Introduction by Eric M. Burke, Principal Software Engineer Object Computing, Inc. (OCI) By now, you probably know

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

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

Lab 1 - Setting up the User s Profile UI

Lab 1 - Setting up the User s Profile UI Lab 1 - Setting up the User s Profile UI Getting started This is the first in a series of labs that allow you to develop the MyRuns App. The goal of the app is to capture and display (using maps) walks

More information

Developing Android Applications

Developing Android Applications Developing Android Applications SEG2105 - Introduction to Software Engineering Fall 2016 Presented by: Felipe M. Modesto TA & PhD Candidate Faculty of Engineering Faculté de Génie uottawa.ca Additional

More information

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review)

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University. Overview (Review) EECS 4443 Mobile User Interfaces More About Layouts Scott MacKenzie York University Overview (Review) A layout defines the visual structure for a user interface, such as the UI for an activity or app widget

More information

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator.

Mobile Application Development Lab [] Simple Android Application for Native Calculator. To develop a Simple Android Application for Native Calculator. Simple Android Application for Native Calculator Aim: To develop a Simple Android Application for Native Calculator. Procedure: Creating a New project: Open Android Stdio and then click on File -> New

More information

Graphical User Interfaces

Graphical User Interfaces Graphical User Interfaces Some suggestions Avoid displaying too many things Well-known anti-patterns Display useful content on your start screen Use action bars to provide consistent navigation Keep your

More information

Multiple Activities. Many apps have multiple activities

Multiple Activities. Many apps have multiple activities Intents Lecture 7 Multiple Activities Many apps have multiple activities An activity A can launch another activity B in response to an event The activity A can pass data to B The second activity B can

More information

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Diving into Android. By Jeroen Tietema. Jeroen Tietema, Diving into Android By Jeroen Tietema Jeroen Tietema, 2015 1 Requirements 4 Android SDK 1 4 Android Studio (or your IDE / editor of choice) 4 Emulator (Genymotion) or a real device. 1 See https://developer.android.com

More information

University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World

University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World University of Stirling Computing Science Telecommunications Systems and Services CSCU9YH: Android Practical 1 Hello World Before you do anything read all of the following red paragraph! For this lab you

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

Embedded Systems Programming - PA8001

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

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

Android HelloWorld - Example. Tushar B. Kute,

Android HelloWorld - Example. Tushar B. Kute, Android HelloWorld - Example Tushar B. Kute, http://tusharkute.com Anatomy of Android Application Anatomy of Android Application Java This contains the.java source files for your project. By default, it

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

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

This lecture. The BrowserIntent Example (cont d)

This lecture. The BrowserIntent Example (cont d) This lecture 5COSC005W MOBILE APPLICATION DEVELOPMENT Lecture 10: Working with the Web Browser Dr Dimitris C. Dracopoulos Android provides a full-featured web browser based on the Chromium open source

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

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University

EECS 4443 Mobile User Interfaces. More About Layouts. Scott MacKenzie. York University EECS 4443 Mobile User Interfaces More About Layouts Scott MacKenzie York University Overview (Review) A layout defines the visual structure for a user interface, such as the UI for an activity or app widget

More information

Mobile Computing Practice # 2a Android Applications - Interface

Mobile Computing Practice # 2a Android Applications - Interface Mobile Computing Practice # 2a Android Applications - Interface 1. Create an Android Lunch Places List application that allows the user to take note of restaurant characteristics like its name, address

More information

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

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

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

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

CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples. Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples. Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 3: Android UI Design in XML + Examples Emmanuel Agu Resources Android Resources Resources? Images, strings, dimensions, layout files, menus, etc that your

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

Stanislav Rost CSAIL, MIT

Stanislav Rost CSAIL, MIT Session 2: Lifecycles, GUI Stanislav Rost CSAIL, MIT The Plan 1 Activity lifecycle Service lifecycle 2 Selected GUI elements UI Layouts 3 Hands on assignment: RoboChat Application GUI Design Birth, death,

More information

CS371m - Mobile Computing. More UI Navigation, Fragments, and App / Action Bars

CS371m - Mobile Computing. More UI Navigation, Fragments, and App / Action Bars CS371m - Mobile Computing More UI Navigation, Fragments, and App / Action Bars EFFECTIVE ANDROID NAVIGATION 2 Clicker Question Have you heard of the terms Back and Up in the context of Android Navigation?

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

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu

Java & Android. Java Fundamentals. Madis Pink 2016 Tartu Java & Android Java Fundamentals Madis Pink 2016 Tartu 1 Agenda» Brief background intro to Android» Android app basics:» Activities & Intents» Resources» GUI» Tools 2 Android» A Linux-based Operating System»

More information

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial Revision history 90001431-13 Revision Date Description A October 2014 Original release. B October 2017 Rebranded the document. Edited the document.

More information

Mobile and Ubiquitous Computing: Android Programming (part 3)

Mobile and Ubiquitous Computing: Android Programming (part 3) Mobile and Ubiquitous Computing: Android Programming (part 3) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Based on Programming Handheld Systems, Adam Porter, University

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

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

COMP4521 EMBEDDED SYSTEMS SOFTWARE

COMP4521 EMBEDDED SYSTEMS SOFTWARE COMP4521 EMBEDDED SYSTEMS SOFTWARE LAB 1: DEVELOPING SIMPLE APPLICATIONS FOR ANDROID INTRODUCTION Android is a mobile platform/os that uses a modified version of the Linux kernel. It was initially developed

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

Spring Lecture 4 Lecturer: Omid Jafarinezhad

Spring Lecture 4 Lecturer: Omid Jafarinezhad Mobile Programming Sharif University of Technology Spring 2016 - Lecture 4 Lecturer: Omid Jafarinezhad User Interface All user interface elements in an Android app are built using View and ViewGroup objects.

More information