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)
Related
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.
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!
I know I could set a breakpoint at every line where my code changes the variable, but is there an option such as right-clicking a variable (to "Add to Watches") that would stop when a variable changes value?
I think C++ has this option. See this.
And Eclipse? See this.
Is this implemented in AS?
You can break on value changes of some variables in Android Studio 1.1.0.
Android Studio calls them 'Java Field Watchpoints'.
From the breakpoints windows, (Run -> "View breakpoints...") or Ctrl+Shift+F8,
you can add "Java Field Watchpoints" from the plus in the top left corner, and then select your class and variable.
If the goal is simply to set a watchpoint where execution halts if a variable's value changes, there are two methods:
Pressing Ctrl-shift-F8 to set a watchpoint brings up this dialog:
That looks more powerful but it's confusing because it lacks the option I need; and there's an extra step: filling in the dialog box below:
Once you fill it in correctly, you get the same options for stopping execution as in the simpler method below:
Define the variable on one line ending with a semicolon.
Left-click in the area where you set a normal breakpoint and up pops a dialog box.
Choose options to suit your needs.
Any instance where the value of the variable prefDbExists changes, execution will pause as at any "normal" (unconditional) breakpoint. And that's all I needed when I asked the original question.
EDIT: Fully qualified class name is {package name}.{class name})
What you seek for is commonly known as "WatchPoint".
You will find detailed answer and examples on the doc. page of JetBrains - IntelliJ - Idea which is the basis for Android Studio.
https://www.jetbrains.com/help/idea/2016.3/creating-field-watchpoints.html
For me this works perfectly !
Add a Kotlin Field Watchpoint by clicking on the space next to the line number for the field declaration in Android Studio. Select Kotlin Field Watchpoint from the Set Breakpoint menu. You will now get a breakpoint whenever that value changes.
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.
Eclipse version: Indigo Service Release 2
ADT version: 18.0.0.v201203301601-306762
I have the following code in Eclipse
View view = inflater.inflate(R.layout.somelayoutfile, parent, false);
I want to perform some action, like CTRL+Click on "R.layout.somelayoutfile" and it jump to that xml file. Instead it takes me to "R.java."
According to this the Android Documentation this should be supported, but it doesn't work. Does anyone know why, and/or how to enable this feature?
The most efficient way.
Eclipse settings - Hyperlinking - Open Declaration - uncheck.
CMD+Click will start to navigate you directly to XML instead of R class.
You'll still be able to use the Open Declaration by pressing F3.
If you hold Ctrl with the pointer over the resource name (somelayoutfile in your example) then a menu should appear, with two options:
Open declaration
Open declaration in layout/somelayoutfile.xml
That isn't working for you? Or you want the default (direct click on the resource name) to be the second option?
You Can Use Ctrl+Alt+Shift and click on res
or on Preferences -> General -> Editors -> Text Editors -> Hyperlinking you can change shortcut key
CTRL + CLICK is the correct way to do that, but sometimes it doesn't work correctly, I don't know why. It's aggravating, I know. If I were you, I'd try one or both things below.
Usually I'll clean my project and if that doesn't fix it, then I'll restart Eclipse and then clean again. One of those two will typically do the trick for me.
Hold down ctrl (or command on Mac) THEN move your cursor over the resource name. If you move your cursor to the resource name, and then hit ctrl, it will not underline the resource name and will not provide a link. You have to hit ctrl and then move the cursor.