The previous post of the Android Activities and Tasks series explained the concept of Android’s intents. We have seen how to use them to launch activities and how to utilize intent flags to customize the behavior of the launch to our needs.
In this post, we focus on activities themselves and explain the properties we can set on an activity or task to influence the activity launch behavior on the receiver side. In detail:
- activity launch modes
- task attributes
- task affinities of activities
Android applications can grow very quickly. As they are composed of components (Activities, Services and Content Providers), it should be easy to extend an existing application to create new applications by just reusing already developed components. Recently, the akquinet Mobile Team had to develop several versions of the same application with a different set of features. This might sound easy, but Android does not really support such kind of modular development. Indeed, we faced several issues coming from the Android development model.
This blog post explains the encountered issues and how we fixed them by using rindirect. This tool allows, inside an Android application, to integrate components defined in other Android applications. This reuse pattern is close to impossible to achieve without rindirect or implies major limitations. Rindirect is developed by akquinet and is now available as open-source. This tools is well suited for Maven-based development, and so, works pretty well alongside the maven-android plugin.
Despite of not being in widespread use in the Android world, Apache Maven is a great tool to develop Android applications. Maven has a lot of advantages relevant for Android application development:
- It can be integrated on a continuous integration server, allowing continuous testing and nightly-build delivery
- It provides a strict release process avoiding errors and inconsistencies. The resulting APK are ‘marketplace-ready’
- It also provides a common way to build and package the applications
- It supports modular-development allowing the integration of classes and resources from others projects
This post explores how to quickly start developing Android applications using Maven. It presents three archetypes allowing getting a running application in less than 2 minutes!
The previous post of the Activities and Tasks series gave an introduction to the concepts behind activities and tasks. We have seen that activities correspond to visible screens in the UI, that activities are grouped as stacks within tasks, and tasks are sent to the background and foreground as atomic units. In this post of the series, we focus on Android’s intent concept and address the following questions:
- What are intents?
- How do we use them to launch activities?
- What options (flags) does Android provide to customize this launch? (e.g. in terms of target task or activity instance creation)
Android application user interfaces are decomposed into ‘screens’ called activities. The user navigates from screen to screen thanks to buttons, clickable elements, keyboard keys, gestures, etc. Each activity manages one ‘screen’. Beyond those screens, ‘activity instances’ are created, configured, destroyed, recreated following a somewhat sophisticated lifecycle. To develop an activity, developers need to create a class extending the
Activity base class and override a couple of methods to react to lifecycle transition, events etc. This blog post highlights the threading issues encountered when developing a responsive Activity.
With Android, Google implemented its very own UI component model, introducing various new terms and concepts probably unfamiliar to most developers. Although well designed and powerful, it is unconventional, has a high learning curve and, in some respects, lacks sufficient documentation. Basic use cases may be quick to implement, but in order to develop more complex applications, a thorough understanding of Android’s UI component model is essential.
This series aims at providing this understanding while focusing on the UI related concepts of activities and tasks.