Resource files are one of the major strength in Android SDK that allows you to separate presentation from application logic. String resources in particular helps to effectively manage multi-lingual applications with ease.
In this tutorial, I will be showing how to use formatted string resources in Android. In addition to discussing the benefits of using formatted strings, the tutorial will show (a) how to define formatted string resources in xml, and (b) how to problematically use them when developing applications.
ActionBar is a user interface (UI) design pattern found in Android that allows users to quickly perform common actions within your application. ActionBar replaces the traditional title bar with a more featured and consistent UI. Popular applications that use this pattern include Facebook App and Twitter App. ActionBars help us to:
- Have a dedicated UI space for commonly used actions in your applications to increase user engagement (e.g. Search, Refresh, display status etc.)
- Have a consistent look and feel across all activities
- Allows the user to perform common/key actions quickly without having to use the menu
Though framework support for ActionBars has been added in Android 3.0+ (Honeycomb), developers are required to implement it from scratch for non-tablet versions of Android. The aims of this tutorial are two-fold; Firstly to demonstrate how to build an ActionBar widget from ground up, and secondly to illustrate how to use the ActionBar in your application.
Figure 1 shows an Activity with the ActionBar we are planning to implement in this tutorial.
Figure 1: Action Bar Example
Posted in Android, Development, Guides
Tagged ActionBar, Android, custom style, custom title, custom titlebar, custom widget, Development, Guides, quickaction, tutorial
Often you might want to limit the number of characters a user can enter into your EditText control in Android. There are two ways to accomplish this:
- Using XML (e.g. layout or style)
- By code
I’ve been playing around with Google’s Android mobile operating system for the past month as part of a post-masters project I’m doing at the University of Auckland. Though there are tons of articles and tutorials to get things started at the official Android Developer Center, you can easily get lost when finding how to do some of the simplest of tasks.
Knowing how to debug your mobile applications is one of the fundamental things you should know as an Android (or any) developer. I use Eclipse IDE for development purposes, and the document simply states that I can view log messages from the “Log Cat” view. Few hours into development, I noticed that sometimes my log statements are not displayed in the Log Cat view at all.
In this article, I am giving a step-by-step guide on how to start debugging an Android application using the Eclipse IDE, along with how to write bebug statements and view them during run-time using the Log Cat view. Hopefully this guide will shave few hours off wondering around endless forums on the internet, trying to figure out how to get those log messages to show up!