CMPE277_Lec4_Android_ActionBar_Menu_Security.pdf

CMPE277_Lec4_Android_ActionBar_Menu_Security.pdf - CMPE 277...

Info icon This preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPE 277 COMPUTER ENGINEERING 1 CMPE 277 Instructor: Charles Zhang Fall 2017 Action Bar, Menu, and Security
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CMPE 277 COMPUTER ENGINEERING 2 Activity Life Cycle Activity States: 1. If an activity in the foreground of the screen ( a t t h e t o p o f t h e s t a c k ) , i t is active or running . 2. If an activity has lost focus but is still visible, it is paused . A paused activity is completely alive (it maintains all state and member information and remains attached to the window manager), but can be killed by the system in extreme low memory situations. 3. If an activity is completely obscured by another activity, it is stopped . It still retains all state and member information, however, it is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.
Image of page 2
CMPE 277 COMPUTER ENGINEERING 3 Activity Lifecycle, Deep Dive 1 2 3 1 Entire Lifetime (onCreate() à onDestroy()) 2 Visible Lifetime (onStart() à onStop()) 3 Foreground Lifetime (onResume() à onPause()) Activity with Dialog Displayed BACK Button No interruption
Image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CMPE 277 COMPUTER ENGINEERING 4 The Fragment Life Cycle Fragment Activity
Image of page 4
CMPE 277 COMPUTER ENGINEERING 5 q Action Bar q Options Menu q Context Menu q Contextual Action Bar q Android Security Outline
Image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CMPE 277 COMPUTER ENGINEERING 6 The Action Bar q Introduced in Honeycomb to replace the old- school title bar q Does more than just display a title and an app icon q Can also house menu items q App icon can function as a navigation button
Image of page 6
CMPE 277 COMPUTER ENGINEERING 7 Options Menu, Context Menu, and Context Action Bar (CAB) q Options menu: the menu that can appear on the action bar q Presents choices that refer to the entire screen or the app as a whole q Context menu: a floating menu that appears when the user selects an element (often through long-click) q Provides actions that affect the selected content or context frame q Contextual action bar: displays action items that affect the selected content in a bar at the top of the screen and allows the user to select multiple items q Deprecates context menu from Android 3.0 and higher
Image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CMPE 277 COMPUTER ENGINEERING 8 Options Menu, Context Menu, and Context Action Bar (CAB), continued Pre-Honeycomb Options Menu Options Menu in the Action Bar Context Menu Context Action Bar Overflow menu
Image of page 8
CMPE 277 COMPUTER ENGINEERING 9 Defining an options menu in XML q Menus are a type of resource similar to layouts q You create an XML description of a menu and place it under res/menu q Android generates a resource ID for the menu file that you then use to inflate the menu in code The showAsAction attribute refers to whether the item will appear on the action bar itself or in the overflow menu
Image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CMPE 277 COMPUTER ENGINEERING 10 Options Menu Icon and Text Long-pressing the icon on an action button shows its title
Image of page 10
CMPE 277 COMPUTER ENGINEERING 11 Create an Options Menu q You can do it in either activity or fragment
Image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
CMPE 277 COMPUTER ENGINEERING 12 Responding to Menu Selection
Image of page 12
CMPE 277 COMPUTER ENGINEERING 13 Enabling Ancestral Navigation q
Image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern