Illustration of several Android phones and a checklist

Many programmers will tell you that some of the biggest mistakes they’ve made have been through trial and error. It’s true—development is a skill that takes time and practice. As Android developers improve their skills over time, they’ll make fewer and fewer mistakes, leading to cleaner code, software that performs better, and less bugs. It’s all part of the learning curve.

However, even an experienced developer can benefit from reviewing some of the best practices that Google lays out for Android projects. To help you start your Android app project off on the right foot, here are a few tips and best practices to consider.

Learn XML and Java

Extensible markup language (XML) is a markup language that’s the foundation for the Android user interface (UI) and elements. Java is the back-end coding language of the Android platform, and it’s used with binding functionality with your XML layouts. Let’s take a look at a small example.

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android=">
<variable name="customer" type="com.example.Customer"/>
<TextView android:layout_width="wrap_content"
<TextView android:layout_width="wrap_content"

This small layout has one data object defined as “Customer.” For developers used to binding elements in even web design, this should be intuitive for you. The data element is defined in Java, and then the object data is bound to the front-end layout element. In this example, we have a first and last name. The following Java code is an example of a Customer class used for the binding.

public class Customer {
public final String firstName;
public final String lastName;
public Customer (String firstName, String lastName){
this.firstName = firstName;
this.lastName = lastName;

Notice that the constructor takes a first and last name variable and binds the data to the public class properties. When the screen opens on the device, this data is then bound to the front-end elements.

Before you get started in Android development, you should be proficient in both of these technologies. Understanding the fundamentals of XML formats is relatively easy, but Java is an object-oriented language and object-oriented programming (OOP) can be challenging if you’re not familiar with the concept. A newer language and framework, Kotlin, has been introduced to help advance Android app development. It can also be used with legacy Java apps as Kotlin co-operates with Java code.

The best way to learn Java is to dive into someone else’s code. GitHub is filled with open-source projects that help you understand Java and OOP concepts. The better your OOP skills are, the easier it will be to create a better coded, less buggy Android app.

Understand Memory Limitations

Mobile devices don’t have the high memory limitations that desktops have. In mobile programming, you must learn to code with smaller memory limitations in mind. If you carelessly use memory on an Android device, you run the risk of your app crashing due to “out of memory” errors.

To work around this, use services on the device sparingly and release memory resources when your app is hidden. You can release memory resources by overriding the onTrimMemory event although you should know that this isn’t a magic solution that allows you to ignore other performance optimization throughout your code. The following is a small sample of pseudocode that shows you how to override the event.

public void onTrimMemory(int level) {
if (level >= TRIM_MEMORY_MODERATE) {
//release resources here

Google also recommends that you avoid or at least reduce the use of bitmaps to lower the memory use when your app is running on the device. You can also use third-party tools such as Picasso or Fresco.

Use the Default Keyboard Based on Required Input

When the user clicks an input text box in an app, the keyboard that pops up should automatically display the characters required to send the right kind of input. For example, if the user is entering a phone number, a numerical keyboard should be the default keyboard. If the app is requesting an email, a keyboard with characters, @ symbols, and a .com key should display.

The EditText box can be used for characters, numbers, or alphanumeric input. The type of input you set for your EditText drives the keyboard that displays on the device. Take the following EditText box for example.

android:numeric="integer" />

Notice that the last property indicates that the input should be numeric. When the user clicks this form element, a numeric keyboard displays. Using this standard makes it easier for your users to fill out forms by providing them with the type of input they should be using.

Always Consider User Security

It’s estimated that more people use mobile devices to access the internet than desktops. This makes mobile apps a bigger target for hackers. When you create your mobile apps, always keep user security in mind. Security should be a priority and often needs research to develop an app that follows best practices to avoid common flaws.

For instance, when you create and store files on the device, don’t allow all other applications to read and write to them. Specifically, don’t create files with the MODE_WORLD_READABLE or MODE_WORLD_WRITABLE permission options.

Also, never use broadcast intents to pass sensitive data. This allows a malicious application to sniff the data. Instead, use explicit intents to keep data secure.

Finally, use WebView with caution. This is probably one of the biggest potential security flaws in a mobile app. Disable JavaScript and plugin support if you don’t need it with your app, and disable local file access to protect your app’s sensitive data.

Don’t Use the Emulator for Real-World Testing

The Emulator in Android Studio is great for development and even debugging, but it doesn’t fully simulate a working Android device. You can assume basic environment features with the Emulator, but when it comes to testing, you should always use actual devices.

Of course, this is a huge investment for an Android developer, but it will make the entire development and testing life cycle much more efficient. It also ensures that you’re able to test your apps in various situations as the user changes settings on the actual device. You can, however, use automated cloud solutions such as Amazon’s Testing platform.

Testing should never be taken lightly. It should be a major investment when you design and deploy apps for your clients. Fewer bugs means happier users, and it can also mean a more successful app in Google Play. This doesn’t mean that you need to buy every device on the market to test your app on, but you should account for some of the more popular ones and the most common screen sizes.


Mobile development is still a new frontier for developers, and plenty of clients are looking for an Android developer to turn their idea into a tangible product. Whether you’re just starting out or are a seasoned pro, you should consider these and other best practices. And above all else, consider your users’ best interests when designing your code and interface. This will lead to a more efficient product and happier clients as you continue to develop apps in the future.