In Eclipse, I can put my cursor on a method name and hit ctrl-space and I get a list of available template proposals.
In Android Studio, when I'm typing a method name and open paren, I get a list of template proposals, but afterwards, how do I see the list again? I've already got show quick doc on mouse move, but that only shows the method signature I selected at first. I want to see alternatives to what I selected the first time through.
How do I show alternative method signatures, aka alternative template proposals?
EDIT:
Thanks to AndroidMechanic for answering Ctrl-P.
Here is what it looks like in Android Studio:
Here is what it looks like in Eclipse: . Notice that you're presented with the documentation in Eclipse, which I find helpful. But Ctrl-P gets me most of the way there.
In android studio to see all method overloads click inside the parenthesis and hit Ctrl + P. This will show you the different combinations you could pass as parameters to a method.
Related
While using AndroidStudio I accidentally came across feature called LogcatFilter.
You can create a file with .lcf extension the following way:
Press command + shift + N. The following dialog will appear
2. Select LogcatFilter option. An empty file scratch.lcf will be created.
From the name of this feature I understand that somehow it can be used to filter out logs from Logcat, but I haven't found any documentation or articles on how to use it.
So, my question is how I can use LogcatFilter? Which format should I use to type my filter?
I'm new to Andriod Studio, but I have been using PHP Storm and Webstorm for years.
When I type for example var_dump() in PHP Storm, autocomplete will finish line for me and put cursor inside brackets (which is logical, because I will probably type something in).
Same goes for Webstorm, if I type console.log() autocomplete will finish line for me and put cursor inside brackets.
But If type for example println()in Kotlin in Android Studio, cursor will be right after closed bracket.
Tried to find setting to overcome this but with no luck.
I checked settings inside Settings / Editor / General / Smart Keys in IDE, but didn't find solution.
Live Templates are what you need, I think. Actually, Android Studio already has one for that. Just type 'sout' inside your Kotlin file and the IDE will create a println() with a cursor inside of it instead of a cursor outside of it. To check this, go to File>Settings>Live Templates and, on the Kotlin list, search for 'sout'. Maybe this article can also help you: https://medium.com/google-developers/writing-more-code-by-writing-less-code-with-android-studio-live-templates-244f648d17c7
I wasn't sure exactly what headline to give this question because I'm not sure what this is technically called. In Android Studio while typing out Espresso tests I noticed that it refuses to accept something like this:
onView(withId(R.id.someId)).perform(click());
and instead will only accept this:
Espresso.onView(ViewMatchers.withId(R.id.someId)).perform(ViewActions.click());
even though every example that I've seen online shows the first example as correct code. Why is Android Studio forcing me to preface every ViewMatcher/Espresso/ViewActions/etc. method with the classname even after the imports are included in my class?
To clarify - trying to use the first example shows "cannot resolve method" and using autocomplete on it (which I have to do several times before it will work) invariably autocompletes to the second example. In all the "regular" code for my project autocomplete works correctly and short method names are recognized. I've tried doing a "clean" and "invalidate cache and restart" but no change.
Example of Google doc that shows usage according to the shortened code:
https://developer.android.com/training/testing/ui-testing/espresso-testing.html
You can try to check out your Android Studio Preferences for imports. Just go to Preferences -> Search "imports"
Here are the settings that I use and I don't have that issue:
What fixed the issue for me: just removed red withId in one place. Then just re-entered "withId": after that all the other red withId were replaced with black text color withId and now it compiled successfull!
Using the latest version of Android Studio.
Once you type the function name and open brackets, AS would automatically display hint with variable type and name (which is really handy). But sometimes it would just disappear.
Does anyone know the keymap (shortcut) that would trigger it to pop again? (haven't found one in AS options, may be I missed one). In particular, I'd like to know the name of the corresponding shortcut so that I can find it through the Preferences screen and update the assigned keys if necessary.
The command name is "Parameter Info".
On Mac, it's assigned to Command+P by default.
On Windows, it's assigned to Ctrl+P by default.
And It's form View menu, called Parameter Info. There is the shortcut on menu.
To display a dropdown version of all the available parameters, you can use Ctrl + Space to show a dropdown list.
When editing android xml files.
IntelliJ allows me to complete android:screenOrientation by typing a:sc then I get my tag first in list.
In Eclipse, I have to type android:sc before I get my tag on top. If I type a: in Eclipse it empties list.
Is there a workaround or setting?
You can type sc only and press Ctrl+space.
Eclipse will suggests you the list of tags that starts with android:sc.
No need to type android:s to get the tags which starts with s.
this method used to work for me.
But for some reason when I press Ctrl+Space now, eclipse auto complete without popping the proposal window, and without understanding the context.
(if i'll type for example si and press Ctrl+Space eclipse will complete the word to a word starting with si instead of suggesting android:textsize as it used to do)