Go to File -> Settings -> Editor -> Auto Import -> Java and make the below things:
Select Insert imports on paste value to All
Do tick mark on Add unambigious imports on the fly option and "Optimize imports on the fly*
質問
I've just switch to Android Studio 0.5.1, and the things going so slow here, because nothing works in the regular way...
How do I import the necessary classes with shortcut?
I mean like this ones?
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
解決
Go to File -> Settings -> Editor -> Auto Import -> Java and make the below things:
Select Insert imports on paste value to All
Do tick mark on Add unambigious imports on the fly option and "Optimize imports on the fly*
他のヒント
Go on the missing declaration with cursor and press alt+enter
Ctrl + Alt + O to optimize imports
On my Mac Auto import option was not showing it was initially hidden
Android studio ->Preferences->editor->General->Auto Import
and then typed in searched field auto then auto import option appeared.
And now auto import option is now always shown as default in Editor->General
.
hopefully this option will also help others.
See attached screenshot
To import classes on the fly :
On OSX press Alt(Option) + Enter.
File -> Settings -> Keymap Change keymaps settings to your previous IDE to which you are familiar with
You can also use Eclipse's keyboard shortcuts: just go on preferences > keymap and choose Eclipse from the drop-down menu. And all your Eclipse shortcuts will be used in here.