Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the shortcut to Auto import all in Android Studio?

Is there any way of auto importing (like in Eclipse Shift+Ctrl+O) in Android Studio?

I have found only Ctrl+Alt+O which ask for each thing, and I have to press Alt+Enter to accept it.

No way to do it faster?

like image 826
Michał Tajchert Avatar asked May 17 '13 17:05

Michał Tajchert


People also ask

What is the shortcut key of import?

Cmd+I is the shortcut for Import, but just remember, that brings up this traditional import dialog, where you search for what you want and bring it into the project.

How do I enable auto import?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), click Editor | General | Auto Import. Enable the Optimize imports on the fly option and apply the changes.


2 Answers

For Windows/Linux, you can go to File -> Settings -> Editor -> General -> Auto Import -> Java and make the following changes:

  • change Insert imports on paste value to All

  • markAdd unambigious imports on the fly option as checked

On a Mac, do the same thing in Android Studio -> Preferences

enter image description here

After this, all unambiguous imports will be added automatically.

like image 196
Vladimir Mironov Avatar answered Oct 01 '22 23:10

Vladimir Mironov


These are the shortcuts used in Android studio

Go to class CTRL + N
Go to file CTRL + Shift + N
Navigate open tabs ALT + Left-Arrow; ALT + Right-Arrow
Look up recent files CTRL + E
Go to line CTRL + G
Navigate to last edit location CTRL + SHIFT + BACKSPACE
Go to declaration CTRL + B
Go to implementation CTRL + ALT + B
Go to source F4
Go to super Class CTRL + U
Show Call hierarchy CTRL + ALT + H
Search in path/project CTRL + SHIFT + F

Programming Shortcuts:-

Reformat code CTRL + ALT + L
Optimize imports CTRL + ALT + O
Code Completion CTRL + SPACE
Issue quick fix ALT + ENTER
Surround code block CTRL + ALT + T
Rename and Refractor Shift + F6
Line Comment or Uncomment CTRL + /
Block Comment or Uncomment CTRL + SHIFT + /
Go to previous/next method ALT + UP/DOWN
Show parameters for method CTRL + P
Quick documentation lookup CTRL + Q
Delete a line CTRL + Y
View declaration in layout CTRL + B

For more info visit Things worked in Android

like image 26
Kumanan Android Avatar answered Oct 02 '22 00:10

Kumanan Android