For Android programmers, there are a lot of places where we need to be aware of Android apps, and here's where Android123 by browsing through most of the source code.
I. cursor of the database
For the Android SQLite database encapsulated query return object cursor It's more error prone to have
1. Cursor return may be null.
If query returns an empty cursor object, any method that executes cursor must have a null pointer exception, which is not noticed by 40% of the Android code.
2. Cursor returned to 0.
We just judge not to be empty yet, if the object of cursor is 0, execute Movetofirst (); This approach is more embarrassing, the Android development network is particularly prompted attention.
3. Movetofirst () is not executed while traversing the cursor, so that the position of the cursor is indeterminate.
4. Cursor after use to manually shut down, Cursor.close () This method do not forget.
5. The types of cursor, such as Getint and Getlong, are always remembered for the conversion, since both the Boolean and long types are sqlite integers in SQLite.
Second, the new service, activity is not registered in the Androidmanifest.xml, for the activity is good to say, if the service at the same time service use of package Name does not differ from the package name of the main program remember to manually write the relative package name
Third, Parcelable the internal class exception handling when used, for example, when the bitmap object is stored internally, the problem arises if the bitmap object is empty.