Monthly archives: October, 2016

Preserving Navigation when Starting an Activity in Android

Part of designing a notification is preserving the user’s expected navigation experience. For a detailed discussion of this topic, see the Notifications API guide. There are two general situations: Regular activity You’re starting an Activity that’s part of the application’s normal workflow. Special activity The user only sees this Activity if it’s started from a …

Building a Notification in Android

This lesson explains how to create and issue a notification. The examples in this class are based on the NotificationCompat.Builder class.NotificationCompat.Builder is in the Support Library. You should use NotificationCompat and its subclasses, particularly NotificationCompat.Builder, to provide the best notification support for a wide range of platforms. Create a Notification Builder When creating a notification, …

Implementing Descendant Navigation in Android

Descendant navigation is navigation down the application’s information hierarchy. This is described in Designing Effective Navigation and also covered in Android Design: Application Structure. Descendant navigation is usually implemented using Intent objects and startActivity(), or by adding fragments to an activity using FragmentTransaction objects. This lesson covers other interesting cases that arise when implementing descendant …

Adding Swipe-to-Refresh To Your App in Android

The swipe-to-refresh user interface pattern is implemented entirely within theSwipeRefreshLayout widget, which detects the vertical swipe, displays a distinctive progress bar, and triggers callback methods in your app. You enable this behavior by adding the widget to your layout file as the parent of a ListView or GridView, and implementing the refresh behavior that gets …

Using Big View Styles in Android

Notifications in the notification drawer appear in two main visual styles, normal view and big view. The big view of a notification only appears when the notification is expanded. This happens when the notification is at the top of the drawer, or the user clicks the notification. Big views were introduced in Android 4.1, and …

Updating Notifications in Android

When you need to issue a notification multiple times for the same type of event, you should avoid making a completely new notification. Instead, you should consider updating a previous notification, either by changing some of its values or by adding to it, or both. The following section describes how to update notifications and also …