Menus. Menus are a common user interface component in many types of applications. The options menu is the primary collection of menu items for an activity.

Slides:



Advertisements
Similar presentations
CE881: Mobile and Social Application Programming Simon M. Lucas Quiz, Walkthrough, Exercise, Lifecycles, Intents.
Advertisements

CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
 Options Menu ◦ The primary collection of menu items for an activity, which appears when the user touches the MENU button. When your application is running.
 User Interface - Raeha Sandalwala.  Introduction to UI  Layouts  UI Controls  Menus and ‘Toasts’  Notifications  Other interesting UIs ◦ ListView.
Cosc 5/4730 Blackberry and Android: Menus. BLACKBERRY.
Chapter 7: Sub and Function Procedures
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
Android Development (Basics)
CST JavaScript Validating Form Data with JavaScript.
Chapter 8: String Manipulation
Programming with Microsoft Visual Basic th Edition
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Favorite Twitter® Searches App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 5: Investigate! Android Lists, Arrays,
@2011 Mihail L. Sichitiu1 Android Introduction GUI Menu Many thanks to Jun Bum Lim for his help with this tutorial.
Domain 3 Understanding the Adobe Dreamweaver CS5 Interface.
INTRODUCTION TO ANDROID. Slide 2 Application Components An Android application is made of up one or more of the following components Activities We will.
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
Android Boot Camp for Developers Using Java, 3E
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
To access our web services, go to……. Click on Customer Login.
Copyright© Jeffrey Jongko, Ateneo de Manila University Editing ListAdapter Data part 2.
Android 11: Events, Menus, and the Action Bar Kirk Scott 1.
Styles, Dialog Boxes, and Menus. Styles Allow creation of a common format – placed in res/values/styles.xml – file name is incidental Can be applied.
Working with Multiple Activities. Slide 2 Introduction Working with multiple activities Creating multiple views Introduction to intents Passing data to.
User Interface Design using jQuery Mobile CIS 136 Building Mobile Apps 1.
MOBILE COMPUTING D10K-7D02 MC05: Android UI Design Dr. Setiawan Hadi, M.Sc.CS. Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran.
Pearson Webcast Series
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
CS378 - Mobile Computing More UI - Part 2. Special Menus Two special application menus – options menu – context menu Options menu replaced by action bar.
Creating Menus Menu Bar – behaves like standard Windows menus Can be used in place of or in addition to buttons to execute a procedure Menu items are controls.
CHAPTER 4 Fragments ActionBar Menus. Explore how to build applications that use an ActionBar and Fragments Understand the Fragment lifecycle Learn to.
Chapter 7 Multiple Forms, Modules, and Menus. Section 7.2 MODULES A module contains code—declarations and procedures—that are used by other files in a.
ANDROID LAYOUTS AND WIDGETS. Slide 2 Introduction Parts of the Android screen Sizing widgets and fonts Layouts and their characteristics Buttons, checkboxes.
The Flag Quiz app tests your ability to correctly identify 10 flags from various countries and territories.
Chapter 5: Investigate! Lists, Arrays, and Web Browsers.
Fragments and Menus Chapter 4 1. Objectives Learn three different types of menus: options, context, and popup Learn to configure the ActionBar and Toolbar.
.NET MCQs MULTIPLE CHOICE QUESTION
Chapter 5 Validating Form Data with JavaScript
Chapter 2: The Visual Studio .NET Development Environment
Chapter 4: Explore! Decision-Making Controls
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
Topics Graphical User Interfaces Using the tkinter Module
Chapter 1: An Introduction to Visual Basic 2015
Introduction to Event-Driven Programming
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
An Introduction to Computers and Visual Basic
Android 16: Menus Kirk Scott.
Creation of an Android App By Keith Lynn
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
1. Introduction to Visual Basic
Politeknik Elektronika Negeri Surabaya
Mobile Application Development BSCS-7 Lecture # 11
Chapter 2 Visual Basic Interface
How to customize your Microsoft SharePoint Online website
Forms, cont’d.
How to customize your Microsoft SharePoint Online website
CS285 Introduction - Visual Basic
SELECTIONS STATEMENTS
Android Developer Fundamentals V2 Lesson 4
Microsoft Windows 7 Basics
Preference Activity class
Mobile Programmming Dr. Mohsin Ali Memon.
Presentation transcript:

Menus

Menus are a common user interface component in many types of applications. The options menu is the primary collection of menu items for an activity. It's where you should place actions that have a global impact on the app, such as "Search," "Compose ," and "Settings."options menu A context menu is a floating menu that appears when the user performs a long-click on an element. It provides actions that affect the selected content or context frame.floating menu A popup menu displays a list of items in a vertical list that's anchored to the view that invoked the menu.

Defining a Menu in XML For all menu types, Android provides a standard XML format to define menu items. Instead of building a menu in your activity's code, you should define a menu and all its items in an XML menu resource.menu resource You can then inflate the menu resource(load it as a Menu object) in your Activity To use the menu in your activity, you need to inflate the menu resource (convert the XML resource into a programmable object) using MenuInflater.inflate().

Creating an Options Menu To specify the options menu for an activity, override onCreateOptionsMenu() In this method, you can inflate your menu resource (defined in XML) into the Menu provided in the callback

Handling click events When the user selects an item from the options menu (including action items in the action bar), the system calls your activity's onOptionsItemSelected() method. This method passes the MenuItem selected. You can identify the item by calling getItemId(), which returns the unique ID for the menu item (defined by the android:id attribute in the menu resource or with an integer given to the add() method). You can match this ID against known menu items to perform the appropriate action.

When you successfully handle a menu item, return true. If you don't handle the menu item, you should call the superclass implementation of onOptionsItemSelected() (the default implementation returns false).

The final output of menu view will be like below image

Creating a simple menu with 6 menu items. On clicking on single menu item a simple Toast message will be shown.  an XML file will be present under res/menu folder and name it as menu_main.xml. Open menu_main.xml file and type following code. In the following code we are creating a single menu with 6 menu items.  Each menu item has an icon and title for display the label under menu icon.  Also we have id for each menu item to identify uniquely.

Now open your main Activity class file (AndroidMenusActivity.java) and type following code. In the following code each menu item is identified by its ID in switch case statement.

Exersice for today Try option menu. Write Program to demonstrate simple arithmetic operation