This is a mirror of official site: http://jasper-net.blogspot.com/

Android for .NET Developers - Menus and Dialogs

| Tuesday, June 14, 2011
The Android for .NET Developers Series

Part 1 Starting with this article, I'll discuss what you need to know to approach Android programming without any aid from your .NET expertise.
Part 2 In this article, we'll go through an Android application that accepts input from the user and handles user's clicking.
Part 3 In this article, you will learn how to build the user interface.
Part 4 In this article, I'll be delving deep into menus and dialog boxes in Android for .NET, and discuss a few very common (and frequently used) types of menus and dialogs.

Introduction
In Android, you define a large share of the user interface through views. A view is a resource that combines together multiple widgets, including custom widgets you create from existing ones or completely from scratch. A view, however, represents the static part of a user interface, which is the part that is displayed by default as the user navigates to that particular section of the application. As the user interacts with the presented user interface the need for additional input elements may arise. Which kind of additional input elements? I mean portions of the user interface not originally displayed and mostly displayed on demand such as dialog boxes and menus.

Android devices feature a Menu button that, when touched by users, automatically pops up any application registered menu that applies to that context. Dialog boxes, instead, are programmatically displayed under the total control of the developer. The developer, in fact, may decide when to display a given dialog whether after a click on a button or the selection of a menu item. In this article, I'll be delving deep into menus and dialog boxes in Android for .NET, and discuss a few very common (and frequently used) types of menus and dialogs.

Types of Menus in Android
Android defines three distinct types of menus: options, context and submenu. The options menu refers to a feature has similarities with both the main menu and the context menu of desktop applications. In fact, the options menu is always hidden and shows up only when the user touches the Menu button. The options menu is dismissed right after a selection is made. At the same time, the options menu displays always in the same position, that is at the bottom of the screen.

The idea is that, as a user, you touch the Menu button when you're looking for a list of possible actions to take at a given stage of the application. Just for this reason, the list of options presented by the menu may be significantly different at different times. You can handle these differences in either of two ways. You can, for example, create a single menu and add or remove items and disable and enable items on a per-display basis. In alternative, you can reset and repopulate the menu before each display. You typically choose the latter option if the two menus to display are significantly different.

Another type of menu you find in Android is the context menu. It is nearly the same as the context menu of a desktop application. In Android, you associate the context menu with a view or a widget and all you get is a floating list of menu items to choose from. Finally, the submenu is a floating menu used to nest child menus to both options and context menus.

Read more: dot Net Slackers

Posted via email from Jasper-net

0 comments: