Please Help me compile a list of Effective Android Programming techniques
- Don't forget to free resources after use.
Lot of resources like Cursors are overlooked. Free them too.
- Don't Use magic Numbers.
values[0] is meaningless. The framework provides very useful accessors likevalues[SensorManager.DATA_X]
- "Make use of onPause()/onResume to save or close what does not need to be opened the whole time."
protected void onResume() { mSensorManager.registerListener(...); } protected void onStop() { mSensorManager.unregisterListener(...); super.onStop(); }
- Make your Android UI Fast and Efficient from the Google I/O has a lot of useful UI Performance tips.