Category «Android Advanced Concepts»

Animating a Scroll Gesture in Android

In Android, scrolling is typically achieved by using the ScrollView class. Any standard layout that might extend beyond the bounds of its container should be nested in aScrollView to provide a scrollable view that’s managed by the framework. Implementing a custom scroller should only be necessary for special scenarios. This lesson describes such a scenario: …

Tracking Movement in Android

This lesson describes how to track movement in touch events. A new onTouchEvent() is triggered with an ACTION_MOVE event whenever the current touch contact position, pressure, or size changes. As described in Detecting Common Gestures, all of these events are recorded in the MotionEvent parameter of onTouchEvent(). Because finger-based touch isn’t always the most precise …

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 …

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 …