Android Fully Qualify Imports

When you want to use class Bar from package foo,there are two possible ways to import it:

  1. import foo.*;

Pros: Potentially reduces the number of import statements.

  1. import foo.Bar;

Pros: Makes it obvious what classes are actually used. Makes code more readable for maintainers.

Decision: Use the latter for importing all Android code. An explicit exception is made for java standard libraries (java.util.*java.io.*, etc.) and unit test code (junit.framework.*)

Source: http://source.android.com/source/code-style.html

Posted in Android, Tips and Tricks Tagged with: ,