Edwin Chan
Edwin Chan

Reputation: 35

How to import statement in Android Studio

import android.text.EditText;

I can't import anything, when I press ALT + Enter it appeared create test instead of import class, variable and all that. How to import the syntax above?

Upvotes: 1

Views: 2021

Answers (2)

Arun Kumar
Arun Kumar

Reputation: 78

Use Ctrl+Shift+O to organize imports.

Upvotes: 0

Jordi Castilla
Jordi Castilla

Reputation: 26961

Windows/Linux

To import you can use Ctrl+Alt+O which ask for each thing, after you have to press Alt+Enter to accept it.

If you want to change this behaviour to organize all imports go to File -> Settings -> Editor -> General -> Auto Import -> Java and:

  • change Insert imports on paste for All

  • check Add unambigious imports on the fly

Mac

To import you can use option mac+Alt+O which ask for each thing, after you have to press option mac+Enter to accept it.

To change all behaviour are same steps but location is in Android studio > Properties...

Upvotes: 1

Related Questions