Apparently Google no longer supports the Eclipse Android IDE, and I've been having some odd problems with imports in Android studio. When I pasted a code snipped with ContextMenu menu
, it wouldn't import it, even with alt+enter it would not show the appropriate android.view.ContextMenu
.
Now I pasted an example with LAYOUT_INFLATER_SERVICE
, and unfortunately it won't recognize it at all - alt+enter suggests creating a constant, class, field, or renaming. I don't remember having this problem in Eclipse.
Where do I find these constants, or more importantly, how do I get Android-studio to get the right imports without memorizing where these classes/constants are?
What's wrong with Android-Studio imports?
Not much, I'm using it (resp. Intellij Idea) for years now.
When I pasted a code snipped with ContextMenu menu, it wouldn't import it, even with alt+enter it would not show the appropriate android.view.ContextMenu.
This definitely works for me, so it's certainly not a missing feature. I would suspect something in your project / module setup being funny. If you're really serious about it I would try to reproduce the issue on a vanilla project.
Now I pasted an example with LAYOUT_INFLATER_SERVICE, and unfortunately it won't recognize it at all - alt+enter suggests creating a constant, class, field, or renaming.
I can confirm that one. Annoys me too. But then: How should the IDE know about a single String matching some constant definition? I would be surprised if Eclipse did any better...
Try "Symbol-Search" (Ctrl Alt Shift N) or "Search everywhere" (Shift Shift), this should mitigate the problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.