Category «Android Advanced Concepts»

Detecting Common Gestures in Anroid

A “touch gesture” occurs when a user places one or more fingers on the touch screen, and your application interprets that pattern of touches as a particular gesture. There are correspondingly two phases to gesture detection: Gathering data about touch events. Interpreting the data to see if it meets the criteria for any of the …

Maintaining Compatibility in Android

Some material design features like the material theme and custom activity transitions are only available on Android 5.0 (API level 21) and above. However, you can design your apps to make use of these features when running on devices that support material design and still be compatible with devices running previous releases of Android. Define …

Defining Custom Animations in Anroid

Animations in material design give users feedback on their actions and provide visual continuity as users interact with your app. The material theme provides some default animations for buttons and activity transitions, and Android 5.0 (API level 21) and above lets you customize these animations and create new ones: Touch feedback Circular Reveal Activity transitions …

Working with Drawables in Android

The following capabilities for drawables help you implement material design in your apps: Drawable tinting Prominent color extraction Vector drawables This lesson shows you how to use these features in your app. Tint Drawable Resources With Android 5.0 (API level 21) and above, you can tint bitmaps and nine-patches defined as alpha masks. You can …

Dragging and Scaling in Android

This lesson describes how to use touch gestures to drag and scale on-screen objects, using onTouchEvent() to intercept touch events. Drag an Object If you are targeting Android 3.0 or higher, you can use the built-in drag-and-drop event listeners withView.OnDragListener, as described in Drag and Drop. A common operation for a touch gesture is to …

Handling the Results in Android

As shown in the previous lesson, you should begin loading your data with a CursorLoader in your implementation of onCreateLoader(). The loader then provides the query results to your Activity or FragmentActivity in your implementation ofLoaderCallbacks.onLoadFinished(). One of the incoming arguments to this method is aCursor containing the query results. You can use this object …