Why Android Studio auto import Classes inline instead of at the top of my code?

Viewed 225

Every time I need to import classes Android would imported inline like so

android.content.SharedPreferences preferences = android.preference.PreferenceManager.getDefaultSharedPreferences(preference.getContext());

And it repeats for every time I need that class.

I need to change form inline to the top of the code import statements.

1 Answers

I think I found how to fix it in the File -> Settings -> Code Style and then click on the imports tab.

Then just click the default setting in the Scheme on the drop down. The settings are shown in the image below.

[![on top import settings][1]][1]

Then just made sure the auto import settings where right.

[![auto import settings][2]][2]

And now is working fine.

Related