For some reason auto complete no longer works. for example when writing code using the android bitmap class, when i use the dot operator eclipse would suggest methods for that object instance. how do you turn this feature back on?
thanks mat.
I had this same problem. Here is how I solved it.
In Eclipse go to
Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced
And check the boxes labeled "Java Proposals" and hit Apply.
Im my case was API tools proposals the option that cause my autocomplete doesn´t work, here are the 4 default options that must be checked...
API Tools Proposals.
Java Proposals.
SWT Template Proposals.
Template Proposals.
the next time i must be careful when click Ctrl+Space =D
Go to Preferences > Java > Editor > Content Assist and paste "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz." (note the dot after z) into the "Auto activation triggers for Java:" field.
This worked for me ! Now as i type I get autocomplete options
Here's another solution I dicovered:
I would check the other solutions listed here first and if all else fails shut down eclipse then delete the file 'org.eclipse.jdt.ui.prefs' found in the workspace directory (Workspace\.metadata\.plugins\org.eclipse.core.runtime\.settings).
Seems in my case the workspace became corrupted somehow and this fixed it. Haven't yet noticed any adverse effects by doing this.
eclipse use "ctrl+[space]" to show the "css/html/java proposal"
I had the same problem and none of the solutions here worked. For some reason, my Scheme had changed from "default" to "Emacs". So to fix it, I had to go:
Preferences> General> Keys and change the scheme back to default.
Related
I am doing translations on android studio and now I need to replace some strings that I had wrongly translated. When I search using CTRL+SHIFT+F I indeed get all occurrences but when I use the replace shortcut CTRL+SHIFT+R and try to replace I get a quick popup saying Occurrences in project configuration files are skipped then there is a button which says Include them. When I click that button, the find window opens then nothing happens. How do I search and replace from the ENTIRE project including the configuration files?
Select string and use Alt+Shift+R as Eclipse shortcut and Refactor your string, like below screenshots.
There really is no point in editing config files (because all of them are generated by Android Studio) so just don't click the button on the popup you described.
If I am mistaken then tell me what kind of config files you might want to edit.
Edit -> Find -> Replace in path
and then In Project
In Android Studio:
Edit -> Find -> Replace in path
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!
In Android Studio, I sometimes have to rename some field, attribute or method name.
I know I must select its name, then hit Alt+Shift+R. Then I type in the new name, and hit Enter.
However, sometimes it works, and sometimes... it just does nothing at all. The new name is just discarded and replaced with the old ones.
Can someone explain me why and how to force this very basic feature to work ?
I suspect that you've missed the refactor preview window that shows up when AS finds some code that it doesn't know if it should be refactored or not. For example, if the method being modified is referenced in comments, then AS will ask if you want to refactor those comment as well.
using a shortcut for "Rename" Variable Shift + F6
or
Select Variable/Method name -> Right Click in java file -> Refactor -> Rename
This also happens when using dagger and trying to refactor via Shift+f6. Android Studio hesitates when renaming things in generated code (which seems silly). Anyway, doing a project clean and then doing the rename works.
Alt+Shift+R replace a selected String (in your case the selected field, attribute...) and doesn't rename the variable, field... itself.
The feature I use for that task is Rename (not Replace). To achieve that you can either use Shift+F6 or right mouse click > Refactor > Rename. Now it changes the name also in other classes (if necessary).
For me, every time I refactor>rename it was showing me the usages and I changed them manually, but the name of the java class stayed the same, even I changed all the usages.
Finally, I unticked all the boxes, and it worked.
I am trying to rename my eclipse android project. I have tried Android Tools -> Rename Application Package. It gave me an error occurred see log.
I can't find any logs and suddenly this happen my project structure shows some blank and garbage packages as shown in picture.I tried deleting it but deleting them deletes my source code too.Any idea will be very helpful..
You can rename classes, packages and projects by right clicking on the class/package/project and choose: Refactor -> Rename. Check the Update references box to make sure all references to the project/class are also changed.
This behavior is totally ok.
A java package corresponds with an folder.
When a package/folder is empty eclipse will show it as "white boxed" without content (no arrow).
Example:
The class "AClass" in "com.me.pckg" corrensponds with
com/me/pckg/AClass.java
This means folder "com" and "me" contains no files. Eclipse represents this a "white boxed" packages (com and com.me). Package "com.me.pckg" is not empty.
Aware eclipse does not show the package structure NOT as hierarchical as you expect it in a file system view.
Vice versa if you put some file/-structure in your project eclipse will show new folders a packages. This happens after a refresh or a restart of eclipse, the later may be perceived as a sudden action.
If you want to change the type in "com.demo.alaramdemo" use Pieter12345 answer(, or just change the name of the folder in the file system)
If you want a more file system like view within eclipse use the "Navigator"-View
Finally i got the answer to this, With the help of a post above by Stefan
and a solution mentioned here on below link http://www.coderanch.com/t/105581/vc/Eclipse-hide-empty-packages
actually i had to create filters available on a inverted triangle in package explorer header.
In that u have to check filter of empty package , empty parent package etc
it worked for me.
Thanks all for the help ... :)
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.