Category «Android»

Optimizing Content for the Assistant in Android

Android 6.0 Marshmallow introduces a new way for users to engage with apps through the assistant. Users summon the assistant with a long-press on the Home button or by saying the keyphrase. In response to the long-press, the system opens a top-level window that displays contextually relevant actions for the current activity. These potential actions …

Handling App Links in Android

Users following web links on devices are frequently presented with confusing choices. Tapping a link often results in the system asking the user which app should handle that link. For example, clicking a URI in an email from a bank might result in a dialog asking the user whether to use the browser, or the …

Supporting Different Screen Sizes in Android

This lesson shows you how to support different screen sizes by: Ensuring your layout can be adequately resized to fit the screen Providing appropriate UI layout according to screen configuration Ensuring the correct layout is applied to the correct screen Providing bitmaps that scale correctly Use “wrap_content” and “match_parent” To ensure that your layout is …

Supporting Different Densities in Android

This lesson shows you how to support different screen densities by providing different resources and using resolution-independent units of measurements. Use Density-independent Pixels One common pitfall you must avoid when designing your layouts is using absolute pixels to define distances or sizes. Defining layout dimensions with pixels is a problem because different screens have different …

Setting Up the App Bar in Android

In its most basic form, the action bar displays the title for the activity on one side and anoverflow menu on the other. Even in this simple form, the app bar provides useful information to the users, and helps to give Android apps a consistent look and feel. Figure 1. An app bar with the …

Adding and Handling Actions in Android

The app bar allows you to add buttons for user actions. This feature lets you put the most importantactions for the current context right at the top of the app. For example, a photo browsing app might show share and create album buttons at the top when the user is looking at their photo roll; …

Adding an Up Action in Android

Your app should make it easy for users to find their way back to the app’s main screen. One simple way to do this is to provide an Up button on the app bar for all activities except the main one. When the user selects the Up button, the app navigates to the parent activity. …

Action Views and Action Providers in Android

The v7 appcompat support library Toolbar provides several different ways for users to interact with your app. Previous lessons described how to define an action, which can be either a button or a menu item. This lesson describes how to add two versatile components: An action view is an action that provides rich functionality within …

Building and Displaying a Pop-Up Message in Android

You can use a Snackbar to display a brief message to the user. The message automatically goes away after a short period. A Snackbar is ideal for brief messages that the user doesn’t necessarily need to act on. For example, an email app could use a Snackbar to tell the user that the app successfully …