Helpful Hints for Android App Development
While solving problems with Android is a simple task, you may get to the point in app development where you're not sure what to do. The following list should point you in the right direction when you’re in need of help.
Not sure how to solve a particular problem? Visit the forums at StackOverflow.com and use the Android tag. StackOverflow is an Android platform–recommended destination for developer questions.
The most common tasks have already been done for you. A list of common tasks and instructions on how to do them are provided by the Android developer website.
If you’re not sure what a package or class does, place your cursor over the object or class while inside Eclipse to view the documentation pop-up window. If no tool tip exists, you can view the documentation online at Android Developer Reference.
Understand activity and fragment lifecycles. You use them over the course of your development career, and a thorough understanding can help avoid problems.
Remember that you are responsible for saving and restoring instance states in activities and fragments. If you create a member variable in an activity or fragment, make sure you save it in onSaveInstanceState() and restore it using the bundle in onCreate(). Failing to do so can make your activity or fragment appear to work most of the time, but randomly fail in other situations (such as when a user rotates the screen).
To make the stream messages in the DDMS perspective more readable, create a filter that specifically applies to your application logging.
When typing into Eclipse, you sometimes know the name of the destination property, method, or class you’d like to create. However, it does not yet exist. Type the name in the component, Eclipse will inform you that the component cannot be found. Now select it, and press F2. This gives you a small pop-up window that allows you to create through the click of a button.
To quickly navigate around a class file, press Ctrl+O and start typing the name of the member you’re interested in. Select it from the pop-up list and press Enter.