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

Size: px
Start display at page:

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

Transcription

1 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 to Action Bar Add Custom Icon to Action Bar 2. Compare the simple list using different approach (Page 9 14) simple_list_item_1 simple_list_item_single_choice simple_list_item_checked simple_list_item_multiple_choice 3. Create the complicate list using advanced list technique (Page 15 20) Create List using ListActivity Switch on Text Filter Attach a Context Menu Peter Lo 2015

2 1. Action Bar 1.1 Menu and Submenu 1. Create the Android application using the following attributes. Application Name: MyActionBar Project Name: Package Name: MyActionBar com.example.myactionbar 2. Select the file "menu.xml" in the "res/menu" folder, then right click and select Open With Android Common XML Editor (or double click it to open). 3. In order to create new menu item, press the [Add] button. Then select Create a new element at the top level, in Menu and select Item in the dialog, press [OK] button to confirm. Peter Lo

3 4. Set the Title to Menu Item 1 and save the menu. Repeat the steps to create Menu Item To create sub menu, press the [Add] button. Select Create a new element in the select element, item 2 (Item), and select Sub-Menu in the dialog. Press [OK] button to confirm. 6. To create sub menu item, press [Add] button again. Select Create a new element in the select element, item 2 (Item), and select Item in the dialog. Press [OK] button to confirm. Peter Lo

4 7. Set the Title to Sub Item 3 and save the menu. Repeat the steps to create Sub Item 4 and Sub Item The XML code for the menu look like: <menu xmlns:android=" xmlns:tools=" tools:context="com.example.myactionbar.mainactivity" > <item android:id="@+id/action_settings" android:orderincategory="100" android:showasaction="never" android:title="@string/action_settings"/> <item android:id="@+id/item1" android:title="menu Item 1"/> <item android:id="@+id/item2" android:title="menu Item 2"> <menu> <item android:id="@+id/item3" android:title="sub Item 3"/> <item android:id="@+id/item4" android:title="sub Item 4"/> <item android:id="@+id/item5" android:title="sub Item 5"/> </menu> </item> </menu> 9. Save and execute the app, press the action bar and select Menu Item 2 to display the sub menu. Peter Lo

5 1.2 Attach Menu into Action Bar 1. Select Menu Item 2, and then change the attribute of Show as action to always. 2. The XML for the menu become: <item android:title="menu Item 2" android:showasaction="always"> <menu> <item android:title="sub Item 3"/> <item android:title="sub Item 4"/> <item android:title="sub Item 5"/> </menu> </item> 3. Save and execute the app, can you find the different? Peter Lo

6 1.3 Add System Icon to Action Bar 1. Set the icon for Sub Item 3 2. The XML for the menu become: <item android:id="@+id/item2" android:title="menu Item 2" android:showasaction="always"> <menu> <item android:id="@+id/item3" android:title="sub Item 3" android:icon="@android:drawable/ic_menu_call"/> <item android:id="@+id/item4" android:title="sub Item 4"/> <item android:id="@+id/item5" android:title="sub Item 5"/> </menu> </item> 3. Save and execute the apps, press the Menu Item 2 to check the icon. Peter Lo

7 1.4 Add Custom Icon to Action Bar 1. Drag the picture ic_menu_polyu.png into drawable-hdpi folder, select Copy Files in the File Operation dialog. 4. Set the icon for Sub Item 4 5. The XML for the menu become: <item android:id="@+id/item2" android:title="menu Item 2" android:showasaction="always"> <menu> <item android:id="@+id/item3" android:title="sub Item 3" android:icon="@android:drawable/ic_menu_call"/> <item android:id="@+id/item4" android:title="sub Item 4" android:icon="@drawable/ic_menu_polyu"/> <item android:id="@+id/item5" android:title="sub Item 5"/> </menu> </item> 6. Save and execute the apps, can you see the icon in the menu? Peter Lo

8 1.5 Handling Menu Event 1. Modify the source code for the file "MainActivity.java" as follow to handle menu event. package com.example.myactionbar; import android.app.activity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.widget.toast; public class MainActivity extends Activity protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); return public boolean onoptionsitemselected(menuitem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getitemid(); if (id == R.id.action_settings) { return true; // Handle click event Toast.makeText(this, item.tostring() + " selected", Toast.LENGTH_LONG).show(); return super.onoptionsitemselected(item); Peter Lo

9 2. Save and execute the apps, press Menu button to call up the menu items. Peter Lo

10 2. Simple List 2.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 2. Remove the default text view Hello World 3. Right click the layout, and select Change Layout. 4. Change the layout to List View. Peter Lo

11 5. The layout will be changed to: 6. Modify the source code for the file "MainActivity.java" as follow. package com.example.mysimplelist; import android.os.bundle; import android.app.activity; import android.view.menu; import android.view.view; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; import android.widget.toast; public class MainActivity extends Activity { private ListView ListView1; private String ListItems[] = { "Item 1", "Item 2", "Item 3", "Item 4"; ArrayAdapter<String> protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // Define the visual style and set data for the list view Peter Lo

12 ListView1 = (ListView)findViewById(R.id.ListView1); // Define a new Adapter adapter = new ArrayAdapter<String> (this,android.r.layout.simple_list_item_1, ListItems); // Assign adapter to ListView ListView1.setAdapter(adapter); // Register a callback to be invoked when an item in the list view clicked ListView1.setOnItemClickListener(new OnItemClickListener() { public void onitemclick(adapterview<?> parent, View view, int position, long id) { // Display a toast that show the content of the clicked list item Toast.makeText( getapplicationcontext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); return true; 7. Save and execute the app, then select the list item to observe the result. Peter Lo

13 2.2 Simple List using simple_list_item_single_choice 1. Open the previous project and modify the source code for "MainActivity.java" as follow: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // Define the visual style and set data for the list view ListView1 = (ListView)findViewById(R.id.ListView1); // Define a new Adapter adapter = new ArrayAdapter<String> (this,android.r.layout.simple_list_item_single_choice, ListItems); // Define the selection mode Single choice ListView1.setChoiceMode(ListView.CHOICE_MODE_SINGLE); // Assign adapter to ListView ListView1.setAdapter(adapter); // Register a callback to be invoked when an item in the list view clicked ListView1.setOnItemClickListener(new OnItemClickListener() { public void onitemclick(adapterview<?> parent, View view, int position, long id) { // Display a toast that show the content of the clicked list item Toast.makeText( getapplicationcontext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); ); 2. Save and execute the app, then select the list item to observe the result. Peter Lo

14 2.3 Simple List using simple_list_item_checked 1. Open the previous project and modify the source code for "MainActivity.java" as follow: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // Define the visual style and set data for the list view ListView1 = (ListView)findViewById(R.id.ListView1); // Define a new Adapter adapter = new ArrayAdapter<String> (this,android.r.layout.simple_list_item_checked, ListItems); // Define the selection mode Multiple choice ListView1.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); // Assign adapter to ListView ListView1.setAdapter(adapter); // Register a callback to be invoked when an item in the list view clicked ListView1.setOnItemClickListener(new OnItemClickListener() { public void onitemclick(adapterview<?> parent, View view, int position, long id) { // Display a toast that show the content of the clicked list item Toast.makeText( getapplicationcontext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); ); 2. Save and execute the app, then select the list item to observe the result. Peter Lo

15 2.4 Simple List using simple_list_item_multiple_choice 1. Open the previous project and modify the source code for "MainActivity.java" as follow. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // Define the visual style and set data for the list view ListView1 = (ListView)findViewById(R.id.ListView1); // Define a new Adapter adapter = new ArrayAdapter<String> (this,android.r.layout.simple_list_item_multiple_choice, ListItems); // Define the selection mode Multiple choice ListView1.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); // Assign adapter to ListView ListView1.setAdapter(adapter); // Register a callback to be invoked when an item in the list view clicked ListView1.setOnItemClickListener(new OnItemClickListener() { public void onitemclick(adapterview<?> parent, View view, int position, long id) { // Display a toast that show the content of the clicked list item Toast.makeText( getapplicationcontext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); ); 2. Save and execute the app, then select the list item to observe the result. Peter Lo

16 3. Advanced List Technique 3.1 Create List using ListActivity 1. Create the Android application with the following attributes. Application Name: MyListActivity Project Name: Package Name: MyListActivity com.example.mylistactivity 2. Modify the source code for "MainActivity.java" as follow. package com.example.mylistactivity; import android.os.bundle; import android.app.activity; import android.view.menu; import android.app.listactivity; import android.view.view; import android.widget.arrayadapter; import android.widget.listview; import android.widget.textview; import android.widget.toast; public class MainActivity extends ListActivity { private String ListItems[] = { "Item 1", "Item 2", "Item 3", "Item 4"; private ArrayAdapter<String> protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // setcontentview(r.layout.activity_main); // Define a new Adapter adapter = new ArrayAdapter<String> (this, android.r.layout.simple_list_item_1, ListItems); // Assign adapter to ListView setlistadapter(adapter); Peter Lo

17 // Handle Item click event protected void onlistitemclick(listview list, View view, int position, long id){ Toast.makeText( getapplicationcontext(), ((TextView) view).gettext(), public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); return true; 3. Save and execute the app, then select the list item to observe the result. 3.2 Switch on Text Filter 1. Open the previous project and modify the source code for "MainActivity.java" as follow. protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // setcontentview(r.layout.activity_main); // Define a new Adapter adapter = new ArrayAdapter<String> (this, android.r.layout.simple_list_item_1, ListItems); // Assign adapter to ListView setlistadapter(adapter); Peter Lo

18 // Enables or disables the type filter window getlistview().settextfilterenabled(true); 2. Save and execute the app, then press 1 to observe the result. 3.3 Attach a Context Menu 1. Open the preview project and select the "res/menu" folder. Then right click and select New Android XML File. 2. Set the File as contextmenu and press [Finish] button. Peter Lo

19 3. In order to create new context menu item, press the [Add] button. Then select Item in the dialog, press [OK] button to confirm. 4. Set the Title to Context Menu 1 and save the menu. Repeat the steps to create Context Menu The XML code for the content menu will look like: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android=" > <item android:id="@+id/item1" android:title="context Menu 1"></item> <item android:id="@+id/item2" android:title="context Menu 2"></item> </menu> 6. Modify the source code for "MainActivity.java" as follow. package com.example.mylistactivity; import android.os.bundle; import android.app.activity; import android.view.menu; import android.app.listactivity; import android.view.view; import android.widget.arrayadapter; import android.widget.listview; Peter Lo

20 import android.widget.textview; import android.widget.toast; import android.view.menuitem; import android.view.contextmenu; import android.view.contextmenu.contextmenuinfo; public class MainActivity extends ListActivity { private String ListItems[] = { "Item 1", "Item 2", "Item 3", "Item 4"; private ArrayAdapter<String> protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // setcontentview(r.layout.activity_main); // Define a new Adapter adapter = new ArrayAdapter<String> (this, android.r.layout.simple_list_item_1, ListItems); // Assign adapter to ListView setlistadapter(adapter); // Enables or disables the type filter window getlistview().settextfilterenabled(true); // Handle Item click event protected void onlistitemclick(listview list, View view, int position, long id){ Toast.makeText( getapplicationcontext(), ((TextView) view).gettext(), Toast.LENGTH_SHORT).show(); // Register the content menu for the List item public void oncreatecontextmenu(contextmenu contextmenu, View view, ContextMenuInfo menuinfo) { // Inflate the context menu Peter Lo

21 super.oncreatecontextmenu(contextmenu, view, menuinfo); getmenuinflater().inflate(r.menu.contextmenu, contextmenu); public boolean oncontextitemselected (MenuItem item) { switch(item.getitemid()) { case R.id.item1: Toast.makeText(this, "Context Item 1 selected", Toast.LENGTH_LONG).show(); return true; case R.id.item2: Toast.makeText(this, "Context Item 2 selected", Toast.LENGTH_LONG).show(); return true; default: return public boolean oncreateoptionsmenu(menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getmenuinflater().inflate(r.menu.main, menu); return true; 7. Save and execute the app, then long click the list item to call up the context menu. Peter Lo

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

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

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

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

Q.1 Explain the dialog and also explain the Demonstrate working dialog in android.

Q.1 Explain the dialog and also explain the Demonstrate working dialog in android. Q.1 Explain the dialog and also explain the Demonstrate working dialog in android. - A dialog is a small window that prompts the user to make a decision or enter additional information. - A dialog does

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

Meniu. Create a project:

Meniu. Create a project: Meniu Create a project: Project name: P0131_MenuSimple Build Target: Android 2.3.3 Application name: MenuSimple Package name: ru.startandroid.develop.menusimple Create Activity: MainActivity Open MainActivity.java.

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

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

Tabel mysql. Kode di PHP. Config.php. Service.php

Tabel mysql. Kode di PHP. Config.php. Service.php Tabel mysql Kode di PHP Config.php Service.php Layout Kode di Main Activity package com.example.mini.webandroid; import android.app.progressdialog; import android.os.asynctask; import android.support.v7.app.appcompatactivity;

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

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation

1. Location Services. 1.1 GPS Location. 1. Create the Android application with the following attributes. Application Name: MyLocation 1. Location Services 1.1 GPS Location 1. Create the Android application with the following attributes. Application Name: MyLocation Project Name: Package Name: MyLocation com.example.mylocation 2. Put

More information

05. RecyclerView and Styles

05. RecyclerView and Styles 05. RecyclerView and Styles 08.03.2018 1 Agenda Intents Creating Lists with RecyclerView Creating Cards with CardView Application Bar Menu Styles and Themes 2 Intents 3 What is Intent? An Intent is an

More information

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

Mobile Programming Lecture 3. Resources, Selection, Activities, Intents Mobile Programming Lecture 3 Resources, Selection, Activities, Intents 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

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

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

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

Action Bar. Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps.

Action Bar. Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps. 1 Action Bar Action bar: Top navigation bar at each screen The action bar is split into four different functional areas that apply to most apps. 1) App Icon 3) Action Buttons 2)View Control 4) Action Overflows

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

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

Android Using Menus. Victor Matos Cleveland State University

Android Using Menus. Victor Matos Cleveland State University Lesson 8 Notes are based on: The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright 2008-2009 CommonsWare, LLC. ISBN: 978-0-9816780-0-9 & Android Developers http://developer.android.com/index.html

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

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { }

ActionBar. import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { } Android ActionBar import android.support.v7.app.actionbaractivity; public class MyAppBarActivity extends ActionBarActivity { Layout, activity.xml

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

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

Our First Android Application

Our First Android Application Mobile Application Development Lecture 04 Imran Ihsan Our First Android Application Even though the HelloWorld program is trivial in introduces a wealth of new ideas the framework, activities, manifest,

More information

Android Apps Development for Mobile Game Lesson Create a simple paint brush that allows user to draw something (Page 11 13)

Android Apps Development for Mobile Game Lesson Create a simple paint brush that allows user to draw something (Page 11 13) Workshop 1. Create a simple Canvas view with simple drawing (Page 1 5) Hide Action Bar and Status Bar Create Canvas View Create Simple Drawing 2. Create a simple animation (Page 6 10) Load a simple image

More information

Intents. Your first app assignment

Intents. Your first app assignment Intents Your first app assignment We will make this. Decidedly lackluster. Java Code Java Code XML XML Preview XML Java Code Java Code XML Buttons that work

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

Introducing the Android Menu System

Introducing the Android Menu System Introducing the Android Menu System If you ve ever tried to navigate a mobile phone menu system using a stylus or trackball, you ll know that traditional menu systems are awkward to use on mobile devices.

More information

Programmation Mobile Android Master CCI

Programmation Mobile Android Master CCI Programmation Mobile Android Master CCI Bertrand Estellon Aix-Marseille Université March 23, 2015 Bertrand Estellon (AMU) Android Master CCI March 23, 2015 1 / 266 Navigation entre applications Nous allons

More information

5Displaying Pictures and Menus with Views

5Displaying Pictures and Menus with Views 5Displaying Pictures and Menus with Views WHAT YOU WILL LEARN IN THIS CHAPTER How to use the Gallery, ImageSwitcher, GridView, and ImageView views to display images How to display options menus and context

More information

POCKET STUDY. Divyam Kumar Mishra, Mrinmoy Kumar Das Saurav Singh, Prince Kumar

POCKET STUDY. Divyam Kumar Mishra, Mrinmoy Kumar Das Saurav Singh, Prince Kumar POCKET STUDY Divyam Kumar Mishra, Mrinmoy Kumar Das Saurav Singh, Prince Kumar 1 Under Graduate Student, Department of Computer Science and Engineering, SRM University, Chennai, India 2 Under Graduate

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

Android Using Menus. Victor Matos Cleveland State University

Android Using Menus. Victor Matos Cleveland State University 8 Android Notes are based on: The Busy Coder's Guide to Android Development by Mark L. Murphy Copyright 2008-2009 CommonsWare, LLC. ISBN: 978-0-9816780-0-9 & Android Developers http://developer.android.com/index.html

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

<uses-permission android:name="android.permission.internet"/>

<uses-permission android:name=android.permission.internet/> Chapter 11 Playing Video 11.1 Introduction We have discussed how to play audio in Chapter 9 using the class MediaPlayer. This class can also play video clips. In fact, the Android multimedia 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

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences

ITU- FAO- DOA- TRCSL. Training on. Innovation & Application Development for E- Agriculture. Shared Preferences ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Shared Preferences 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran Tanveer, ITU Experts

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 Beginners Workshop

Android Beginners Workshop Android Beginners Workshop at the M O B IL E M O N D AY m 2 d 2 D E V E L O P E R D A Y February, 23 th 2010 Sven Woltmann, AndroidPIT Sven Woltmann Studied Computer Science at the TU Ilmenau, 1994-1999

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

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

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

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

Mobile Application Development MyRent Settings

Mobile Application Development MyRent Settings Mobile Application Development MyRent Settings Waterford Institute of Technology October 13, 2016 John Fitzgerald Waterford Institute of Technology, Mobile Application Development MyRent Settings 1/19

More information

Android Apps Development for Mobile Game Lesson 5

Android Apps Development for Mobile Game Lesson 5 Workshop 1. Create a simple Environment Sensors (Page 1 6) Pressure Sensor Ambient Temperature Sensor Light Sensor Relative Humidity Sensor 2. Create a simple Position Sensors (Page 7 8) Proximity Sensor

More information

@Bind(R.id.input_ ) EditText EditText Button _loginbutton;

@Bind(R.id.input_ ) EditText EditText Button _loginbutton; package cyborg.pantaucctv; import android.app.progressdialog; import android.content.intent; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.util.log; import android.view.view;

More information

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed.

Action Bar. (c) 2010 Haim Michael. All Rights Reserv ed. Action Bar Introduction The Action Bar is a widget that is shown on top of the screen. It includes the application logo on its left side together with items available from the options menu on the right.

More information

B9: Việc cuối cùng cần làm là viết lại Activity. Tới Example.java và chỉnh sửa theo nội dung sau: Mã: package at.exam;

B9: Việc cuối cùng cần làm là viết lại Activity. Tới Example.java và chỉnh sửa theo nội dung sau: Mã: package at.exam; B9: Việc cuối cùng cần làm là viết lại Activity. Tới Example.java và chỉnh sửa theo nội dung sau: Mã: package at.exam; import java.util.arraylist; import android.app.activity; import android.app.alertdialog;

More information

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches

EMBEDDED SYSTEMS PROGRAMMING UI Specification: Approaches EMBEDDED SYSTEMS PROGRAMMING 2016-17 UI Specification: Approaches UIS: APPROACHES Programmatic approach: UI elements are created inside the application code Declarative approach: UI elements are listed

More information

Preferences. Marco Ronchetti Università degli Studi di Trento

Preferences. Marco Ronchetti Università degli Studi di Trento 1 Preferences Marco Ronchetti Università degli Studi di Trento SharedPreferences SharedPreferences allows to save and retrieve persistent key-value pairs of primitive data types. This data will persist

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

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

Building MyFirstApp Android Application Step by Step. Sang Shin Learn with Passion!

Building MyFirstApp Android Application Step by Step. Sang Shin   Learn with Passion! Building MyFirstApp Android Application Step by Step. Sang Shin www.javapassion.com Learn with Passion! 1 Disclaimer Portions of this presentation are modifications based on work created and shared by

More information

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics

10.1 Introduction. Higher Level Processing. Word Recogniton Model. Text Output. Voice Signals. Spoken Words. Syntax, Semantics, Pragmatics Chapter 10 Speech Recognition 10.1 Introduction Speech recognition (SR) by machine, which translates spoken words into text has been a goal of research for more than six decades. It is also known as automatic

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

Android: Intents, Menus, Reflection, and ListViews

Android: Intents, Menus, Reflection, and ListViews ,,, and,,, and Harvard University March 1, 2011 Announcements,,, and Lecture videos available at: https://www.cs76.net/lectures Section schedule: https://www.cs76.net/sections n-puzzle walkthrough: https://www.cs76.net/sections

More information

Open Lecture Mobile Programming. Intro to Material Design

Open Lecture Mobile Programming. Intro to Material Design Open Lecture Mobile Programming Intro to Material Design Agenda Introduction to Material Design Applying a Material Theme Toolbar/Action Bar Navigation Drawer RecyclerView CardView Support Design Widgets/Tools

More information

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar Design Patterns MSc in Computer Science 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

More information

Have a development environment in 256 or 255 Be familiar with the application lifecycle

Have a development environment in 256 or 255 Be familiar with the application lifecycle Upcoming Assignments Readings: Chapter 4 by today Horizontal Prototype due Friday, January 22 Quiz 2 today at 2:40pm Lab Quiz next Friday during lecture time (2:10-3pm) Have a development environment in

More information

Basic GUI elements - exercises

Basic GUI elements - exercises Basic GUI elements - exercises https://developer.android.com/studio/index.html LIVE DEMO Please create a simple application, which will be used to calculate the area of basic geometric figures. To add

More information

MyDatabaseHelper. public static final String TABLE_NAME = "tbl_bio";

MyDatabaseHelper. public static final String TABLE_NAME = tbl_bio; Page 1 of 5 MyDatabaseHelper import android.content.context; import android.database.sqlite.sqliteopenhelper; class MyDatabaseHelper extends SQLiteOpenHelper { private static final String DB_NAME = "friend_db";

More information

Android Hide Title Bar Example. Android Screen Orientation Example

Android Hide Title Bar Example. Android Screen Orientation Example igap Technologies 1 if(!activitycompat.shouldshowrequestpermissionrationale(this, Manifest.permission.READ_CONTACTS)) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_CONTACTS,

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

Programming with Android: Animations, Menu, Toast and Dialogs. Luca Bedogni. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna

Programming with Android: Animations, Menu, Toast and Dialogs. Luca Bedogni. Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna Programming with Android: Animations, Menu, Toast and Dialogs Luca Bedogni Dipartimento di Informatica: Scienza e Ingegneria Università di Bologna Animations vmake the components move/shrink/color vmainly

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

Android Coding. Dr. J.P.E. Hodgson. August 23, Dr. J.P.E. Hodgson () Android Coding August 23, / 27

Android Coding. Dr. J.P.E. Hodgson. August 23, Dr. J.P.E. Hodgson () Android Coding August 23, / 27 Android Coding Dr. J.P.E. Hodgson August 23, 2010 Dr. J.P.E. Hodgson () Android Coding August 23, 2010 1 / 27 Outline Starting a Project 1 Starting a Project 2 Making Buttons Dr. J.P.E. Hodgson () Android

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

Time Picker trong Android

Time Picker trong Android Time Picker trong Android Time Picker trong Android cho phép bạn lựa chọn thời gian của ngày trong chế độ hoặc 24 h hoặc AM/PM. Thời gian bao gồm các định dạng hour, minute, và clock. Android cung cấp

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

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

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다.

1 카메라 1.1 제어절차 1.2 관련주요메서드 1.3 제작철차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1 카메라 1.1 제어절차 서피스뷰를생성하고이를제어하는서피스홀더객체를참조해야함. 매니페스트에퍼미션을지정해야한다. 1.2 관련주요메서드 setpreviewdisplay() : startpreview() : stoppreview(); onpicturetaken() : 사진을찍을때자동으로호출되며캡처한이미지가전달됨 1.3 제작철차 Step 1 프로젝트를생성한후매니페스트에퍼미션들을설정한다.

More information

Lampiran Program : Res - Layout Activity_main.xml

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

LifeStreet Media Android Publisher SDK Integration Guide

LifeStreet Media Android Publisher SDK Integration Guide LifeStreet Media Android Publisher SDK Integration Guide Version 1.12.0 Copyright 2015 Lifestreet Corporation Contents Introduction... 3 Downloading the SDK... 3 Choose type of SDK... 3 Adding the LSM

More information

API Guide for Gesture Recognition Engine. Version 2.0

API Guide for Gesture Recognition Engine. Version 2.0 API Guide for Gesture Recognition Engine Version 2.0 Table of Contents Gesture Recognition API... 3 API URI... 3 Communication Protocol... 3 Getting Started... 4 Protobuf... 4 WebSocket Library... 4 Project

More information

Android Navigation Drawer for Sliding Menu / Sidebar

Android Navigation Drawer for Sliding Menu / Sidebar Android Navigation Drawer for Sliding Menu / Sidebar by Kapil - Tuesday, December 15, 2015 http://www.androidtutorialpoint.com/material-design/android-navigation-drawer-for-sliding-menusidebar/ YouTube

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 Tutorial: Part 3

Android Tutorial: Part 3 Android Tutorial: Part 3 Adding Client TCP/IP software to the Rapid Prototype GUI Project 5.2 1 Step 1: Copying the TCP/IP Client Source Code Quit Android Studio Copy the entire Android Studio project

More information

Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University.

Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Creating dialogs Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work created and

More information

... 1... 2... 2... 3... 3... 4... 4... 5... 5... 6... 6... 7... 8... 9... 10... 13... 14... 17 1 2 3 4 file.txt.exe file.txt file.jpg.exe file.mp3.exe 5 6 0x00 0xFF try { in.skip(9058); catch (IOException

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

public AnimLayer(Context context, AttributeSet attrs, int defstyle) { super(context, attrs, defstyle); initlayer(); }

public AnimLayer(Context context, AttributeSet attrs, int defstyle) { super(context, attrs, defstyle); initlayer(); } AnimLayer.java package com.kyindo.game; import java.util.arraylist; import java.util.list; import android.content.context; import android.util.attributeset; import android.view.view; import android.view.animation.animation;

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

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

Chapter 7: Reveal! Displaying Pictures in a Gallery

Chapter 7: Reveal! Displaying Pictures in a Gallery Chapter 7: Reveal! Displaying Pictures in a Gallery Objectives In this chapter, you learn to: Create an Android project using a Gallery control Add a Gallery to display a horizontal list of images Reference

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

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

Starting Another Activity Preferences

Starting Another Activity Preferences Starting Another Activity Preferences Android Application Development Training Xorsat Pvt. Ltd www.xorsat.net fb.com/xorsat.education Outline Starting Another Activity Respond to the Button Create the

More information

Android/Java Lightning Tutorial JULY 30, 2018

Android/Java Lightning Tutorial JULY 30, 2018 Android/Java Lightning Tutorial JULY 30, 2018 Java Android uses java as primary language Resource : https://github.mit.edu/6178-2017/lec1 Online Tutorial : https://docs.oracle.com/javase/tutorial/java/nutsandbolts/inde

More information

M.A.D Assignment # 1

M.A.D Assignment # 1 Submitted by: Rehan Asghar Roll no: BSSE (7) 15126 M.A.D Assignment # 1 Submitted to: Sir Waqas Asghar Submitted by: M. Rehan Asghar 4/25/17 Roll no: BSSE 7 15126 XML Code: Calculator Android App

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

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

1. Explain the architecture of an Android OS. 10M The following diagram shows the architecture of an Android OS. 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

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

Database Development In Android Applications

Database Development In Android Applications ITU- FAO- DOA- TRCSL Training on Innovation & Application Development for E- Agriculture Database Development In Android Applications 11 th - 15 th December 2017 Peradeniya, Sri Lanka Shahryar Khan & Imran

More information