This article is in English.
Because I see many bad applications on Android Market, I’m going to start writing a few articles about good (hopefully best) dev practices. For now, let’s see 2 of them.
The First One
The most annoying thing you can find in many current apps, is the location of its files (cache, temp files, database, etc.) on the external memory (e.g. SD card).
So, PLEASE stop creating a folder on the root of the external memory! All your files should be located in this folder: /Android/data/<package_name>. You can read more about this in Google’s Android Dev Guide, right here.
The Second One
The second suggestion (apparently still ignored by developers) would be to use a drawable for each state of your controls (e.g. buttons, list item backgrounds). I’m not going to explain you here how to do it. There are plenty of tutorials over the Internet. Here’s an example, anyway, for a drawable that can be used as background for your list’s items:
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_window_focused="false"
android:state_selected="true"
android:drawable="@drawable/my_blue_background" />
<item
android:state_selected="true"
android:drawable="@android:color/transparent" />
<item
android:state_pressed="true"
android:state_selected="false"
android:drawable="@android:color/transparent" />
<item
android:state_focused="true"
android:drawable="@android:color/transparent" />
<item
android:state_selected="false"
android:drawable="@drawable/my_blue_background" />
</selector>
Obviously, my_blue_background should be a nine-patch, in this case.
For the selected and pressed states, the default drawable is shown (which can be an orange one for stock Android, a green one for HTC Sense UI, a red one for Motorola Cliq, etc.).
This also keeps the transition animation at long press (if you have a long press event on the items of a list), if your phone has one (stock Android UI has it).
I’ve added this example, because the one suggested by Romain Guy in
this session (skip to 30:20) at Google I/O does not work.