I'm using butterknife library to my project to use Bind annotation instead of findViewById.
when I use #Bind(R.id.button) Button mButton;
but never use it, android studio show me warning that I never used it and highlight it with yellow.
when I press Alt+Enter for quick fix -just exploring- and choose the secound choise
suppress for feilds annotated by 'butterkife.Bind'
the warning is gone, but then when I tried to undo what I have done it does't work what ever I tried.
I know it's small thing but it's really annoing.
Open up your Android Studio preferences, and go to Editor > Inspections.
If you want to simply reset everything to the defaults, you can stop here and click "Reset to defaults" under the settings icon to the right of the search box.
If you want to just reset the one inspection, from this list find the inspection that you want to configure. The inspections you have changed should be highlighted in blue. It sounds like you are looking for the "Unused declaration" inspection.
Depending on the inspection, you may see either a "Configure annotations..." button at the bottom of the pane to the right, or a pane that says "Additional special annotations." If you see the button, click it. From the list of annotations, click the minus sign below the pane to remove the exception for that annotation.
If you prefer editing the raw settings files, you can also find your custom inspection rules at <project>/.idea/inspectionProfiles/Project_Default.xml.
Related
please help me remove this annoying squares ! I can't find this option anywhere :(!
Program: android studio
To remove the coloured squares (Also known as inspections) you either need to solve the reason Android Studio has alerted you to that piece of code with a warning/error; or disable the inspections.
To disable one off/singular inspections:
Go to the part of the code which shows the warning/error
Press alt + enter on keyboard
Click "disable inspection"
That specific inspection should disappear
To disable all inspections:
Go to settings, then editor, then inspections
You should see a list of all inspections, here you can edit what ones you want, and how they behave
To turn off an inspection, un-check its tick-box to the right side of the list
To turn off all inspections, just un-check all tick-boxes
IntelliJ IDEA has an inspection that checks for spelling. In the analysis overview, I can see how many spelling mistakes were found, e.g. 12 typos found. In the code they are highlighted using a wavy green line.
However, I find it very hard to look manually for those wavy lines. Is there a keyboard shortcut or a search function which will automatically skip to the next highlighted typo?
F2 and Shift + F2 shortcuts will navigate you to the Next / Previous highlighted error. You need to configure the error navigation first to Go to next problem instead of default Go to high priority problems option(from the context menu of editor right side bar):
See help for details. Another option is to use double click (F4 shortcut) from the Inspection Results window to go to the source.
IntelliJ IDEA 2016.3
If you want to fix all typos from the project, you can list all of them and iterate through them using double click (or F4 to open the source):
Analyze > Run Inspection by Name...
Type "Typo"
You will be able to see a list containing all typos grouped by file:
In Settings -> Editor -> Colors & Fonts -> General, you can add an 'Error stripe mark' color to Typo.
With the default settings of IntelliJ I find it difficult to spot the typos. So I do the following hack to spot and correct them once in a while.
Temporarily change inspection setting to show Typos as Errors.
IntelliJ then highlights the typos as Errors, making it much easier to spot them in the editor. I correct them and then revert the inspection setting changes. The changes can be kept permanently but I don't prefer that!
When editing Java files, if I'm at the end of the line and I type the Enter key, it starts the next line properly indented 4 columns, to match the line above. That's OK but it's indenting with a tab, not spaces, even though in File>Settings>Editor>Java>Tabs and Indents the checkbox for Use tab character is unchecked, and always has been.
If I just type the tab key I also get a tab, not spaces.
I never want to use tab characters; I always want to use spaces. I don't have this problem in Eclipse or Microsoft Visual Studio so it's not some system setting for my PC. Is there some other setting in Android Studio for this?
Edit: I tried the suggestion that Omar Al Halabi (below) made and it didn't work but while testing it I noticed something interesting: This tab problem seems to mainly apply to the beginning of the line, i.e., if I type Enter on the previous line, it immediately tabs over to the first indent position on the following line, using real tabs, not spaces. On the other hand if I'm typing some text on an existing line, once I've typed a little text, if I hit tab, it then tabs over using spaces.
hope this helps,
check Use Tab Character,
give all that values to zero than you not get space on enter in java code, like in below image,
one more thing is you have to change your code format settings or may need to disable it
This is not an answer, but I don't have enough reputation points to post my questions as a comment.
- Is this issue happening in all your Android Studio projects?
- Are you using the Default scheme for the general File->Settings->Editor->Code Style and also for the Java Code Style?
- Have you tried making a new Java Code Style scheme at the Project level for just one project as a test?
EDIT: This is a brute-force/shotgun approach.
Rename your \Users\<username>\.AndroidStudio2.1 directory (e.g., .AndroidStudio2.1_orig)
Open Android Studio and force it to use the default settings by choosing the "I do not have a previous version of Studio or I do not want to import my settings" option when the "Complete Installation" dialog window appears.
Run a recursive 'diff' between the new and old .AndroidStudio2.1 directories to find any changes you've made to the default settings so you can re-apply them. The settings are kept in XML files so they are human-readable. Keep an eye out for any differences that may affect Android Studio use of tabs & spaces, because those might be the source of the problem.
If this does not work, then you may have to re-install Android Studio.
Try opening Settings->Editor->Code Style->Java. Check "Use tab character". Click OK.
Then go to File->Invalidate Caches\Restart -> Invalidate and Restart.
Then, again, go to Settings->Editor->Code Style->Java. Now uncheck "Use tab character" and hit OK.
If it still doesn't work change tab size and indent and then restore them back if you want.
The IDE tries to position the lines as if they belong to the same block. Also very likely you had used the tabs on the previous line. You can try to deactivate Detect and use Existing file indents for editing
Eg:- I want to go through the methods which are in ListActivity class.
In Eclipse when we right click the particular class then in some options we can see all the methods of that class.
How can I do this in Android studio?
In the Project view, you will see something labeled "Structure". If you hit there, you will see all the methods in a given class.
Click on "Structure" on the left pane and you will find all the methods listed
First You have to set your keymap as Eclipse in Android Studio. For this go to
File --> Settings. A new window will open
On the left Hand Side Select KeyMap.
Now on the Right Hand Side there is a dropdown Keymaps
select Eclipse.Click Apply then OK
Now you can press CTRL+Shift+R and type ListActivity to directly open that class. there you will find all the available methods
Another way to see the methods is to
click in the editor area.
Click generate
Click Override methods
There You can see all the available methods that can be overridden
You know about this special quick wrapper, if you select sout, it will wrap System.out.println() around whatever your cursor is at.
I use lots of log.d, log.wtf, is it possible to write my own command like:
'ltf' and it appears in the pop-up window above?
They are called "Live Templates" in AS. Go to Preferences in AS and type there "live" or navigate to Editor - Live Templates. There is a button with "plus" icon on it in the top right corner. Press it to add a new template.
Some Android logger templates are already there, like logd, loge etc. They are expanded by "Tab" key by default.