Import class in android studio [duplicate]
Asked Answered
T

6

3

I am new in Android Studio. I don't know how to import a class in Android Studio, using shortcut key?

I have used Ctrl + 1 like Eclipse but it's not working in Android Studio.

Any solution ?

Tichon answered 30/12, 2015 at 6:4 Comment(2)
Alt+enter in android studioArchangel
If you use OS X, option+return instead.Danette
C
10

Look everytool has its own different ways

for import you can use Alt + Enter

here is link for shortcuts for android studio

for easiness you can do this , you can use Eclipse shortcuts in Androidstudio

File -> Settings -> Keymap -> <Choose Eclipse from Keymaps dropdown> 
Contusion answered 30/12, 2015 at 6:8 Comment(0)
S
4

Use the Alt and Enter keys to import.

Sioux answered 30/12, 2015 at 6:6 Comment(2)
@Er.Rakesh working but i cannot getting options like Import,fix project , etc etc ..Tichon
if single import available then it will add or if multiple option will available then it will give option to choose importSioux
G
2

Alt + Enter in android studio .

Alt + Enter key binding

For quick fixes to coding errors, the IntelliJ powered IDE implements the Alt + Enter key binding to fix errors (missing imports, variable assignments, missing references, etc) when possible, and if not, suggest the most probable solution.

Please read Android Studio Tips and Tricks

Glynisglynn answered 30/12, 2015 at 6:18 Comment(0)
S
1
  1. step 1 > click on the red error code
  2. step 2 > Alt + Enter and you will get a list of recommendations to solve the error
  3. step 3 > if "import class" is available in the list, select it by pressing enter again and the class will import automatically
Semicolon answered 30/12, 2015 at 6:18 Comment(0)
N
1

Also, it's worth noting that you can auto-import classes in Android Studio. Just search for it in Settings and check off "Add unambiguous imports on the fly".

Nadianadine answered 30/12, 2015 at 6:26 Comment(2)
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post. - From ReviewLiberalism
Okay. I'm very new to Stack Overflow, so where should a post like this have gone instead?Nadianadine
M
0

1.step 1 -> Where red error code is showing click on that

2.step 2 -> Now you use ALT+Enter key to import.

Follow this link its useful for you to find shortcut key for android studio :

http://javapapers.com/wp-content/uploads/2014/08/Android-Studio-Shortcuts-You-Need-the-Most.pdf

Mountaineer answered 30/12, 2015 at 6:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.