You cannot import two classes with the same name into the same file. If you import two classes named X and you request X , the compiler does not know which class you are accessing. There is a good compromise in these situations. You can replace this import ...
import android.content.DialogInterface.OnClickListener;
Using this import ...
import android.content.DialogInterface;
Then, when you need to access this particular interface, you can do something like this ...
.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { ... })
This works because DialogInterface is an interface with a nested static interface called OnClickListener . It should be a little better before our eyes, and this solves the problem of name clashes.
source share