Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to auto import the necessary classes in Android Studio with shortcut?

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; 
like image 765
Ilya Libin Avatar asked Mar 08 '14 17:03

Ilya Libin


People also ask

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

You can simply import all of them by pressing the ALT + ENTER key.

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.

Where is auto import in Android Studio?

Save the changes and close settings by pressing OK. In Windows, open the settings by going to File > Settings > Editor > General > Auto Import.

Can I import class in Android Studio?

Auto Import Classes In Android Studio. Click Editor —> General —> Auto Import menu item on the left side of the popup Settings dialog. On the right side, choose All from the Insert imports on paste drop-down list in the Java section. And check the Add unambiguous imports on the fly and all other checkboxes.


2 Answers

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*

Screenshot

like image 161
Ajay S Avatar answered Sep 19 '22 14:09

Ajay S


Go on the missing declaration with cursor and press alt+enter enter image description here

like image 39
Pipo Avatar answered Sep 19 '22 14:09

Pipo