redo button has never worked in android studios? - android

i have found that android studios has never contained any way of 'redoing' a text edit (the opposite of ctrl+z)?
the option exists in the menu/ toolbar but is greyed out. it always has been and it has never functioned.
to test, i have created a clean, empty project, typed in the java class, moved the cursor to elsewhere in the class (incase back to default for some reason prevents it working), typed again.
i then have tested both ctrl+z and manually clicking the undo button, but i am simply NOT ABLE to use the 'redo' option at all. not once since i have been using this IDE.
can ANYONE please explain this behavious and how to get this functionality back? as im finding i often undo one step too many and forget what ive just destroyed.
thanks

Go to File -> Settings -> Keymap
On the right side of the screen, search for "redo" and right-click on the Redo option.
Add a keyboard shortcut (I use ctrl+Y which is pretty standard across applications).

Related

I Have a problem typing in Android Studio

Good morning
I have a problem with Android Studio that drives me crazy, when I select any text in the code the selection turns blue and the cursor stops being a vertical line and becomes a white square, that's when I can no longer write anything, when pressing a couple of keys removes it and returns the cursor to normal but it removes the entire line I have written and it always does. I guess it's some editor option because I've reinstalled it and it still does the same thing, but I can't find a way to remove it and make it behave normally.
Does anyone know what is happening?
Greetings and thank you
i have found the solution, this is:
You should have seen this when there is a Vim option enabled in your Android studio IDE. To resolve this , double press shift which allows to search files and then search for Vim actions. Here, you should see Vim enabled is ticked. Uncheck that option to disable and your cursor becomes normal.
Thanks to Rushi Ayyappa

How can you permanently disable palette and component tree in android studio

I have a problem because I am using a tiling window manager, everytime I open an XML file, in Android studio, then these two small windows open op and block my view of the code. I don't know how I can permanently disable the windows/toolbars/view, (or what you call them)
I use Mod+Q to exit them every time I open the XML file, and it is quite tiring, so I am wondering if there is a way to get rid of these useless panels for goods :-)
I already searched alot in the settings of android studio, and I tried to click remove from sidebar and I even found out that you can click Shift+Escape to hide it, but my fingers gets tired from all this extra clicking everytime I enter XML split mode... :-)
Please Help Me - and thanks in advance! :-)
Thanks in advance.
right click on the title, and click on attached side
then left
then you can minimize it

How to get to know about developer code blame in android studio

I am working on project which is shared by few developers, how to get to know about developer blame in android studio?? any shortcuts or any idea? which will help us to know about code blame.
Use Annotate feature of Android Studio
1.Right click in line number pane
:
2.Select Annotate
You can install GitToolBox plugin to view code blame on every cursor position.
OR
you can view by right clicking on left gutter in android studio, you will have a pop-up with option for Annotation or Annotate with Git Blame.
In addition to rcde0's answer, which I use all the time. You can also add a keyboard shortcut to toggle this view.
Preferences -> Keymap to bring up this screen:
Type "annotate" in the search area. This will find all commands that refer to the word in the search box.
Click on Git->Git->Annotate, this will bring up the first popup, asking how to proceed.
Select "Add Keyboard Shortcut" like I did here:
Another modal window will pop up, asking you to type in a keyboard shortcut. Select the area I'm pointing to and simply type your keyboard shortcut. You can see that I typed ctrlA. I never use it to jump to the beginning of the line, so this works well for me.
If the keystroke is already defined, it will warn you. Feel free to try other keystrokes until you find one that suits your style without eliminating something that you use for other things. Click OK to reassign the keystroke.
You'll now see your new keystroke mapped to the various "Annotate" functions. Hit 'OK' to exit preferences.
Try it out. Type your newly-defined keystroke and see the Annotations in the left gutter toggle on and off.

Refactoring/Renaming Variable in Android Studio Project

I'm writing a little Android App and things are working out nicely, actually. The only problem I'm facing is that Android Studio won't let me refactor all of the occurrences of the variable I inted to rename (see: attached link).
I'm simply using the Alt-Shift-R Shortcut, entering the wanted text and pressing enter. The field variable is changed - but its occurences (though highlighted before) aren't. Using the preview window doesn't change the outcome.
Am I missing anything? I feel like a moron. :')
Variable naming after hitting Enter-Button
valueAusgabe is the previous naming
If you're on Windows or Linux you should be able to rename all occurrences of your variable (variableAusgabe) by just using the Ctrl+Shift+R shortcut.
When you use this, a pop-up shows up and you have to enter the text you want to replace (variableAusgabe), and the text you want to replace it with. Select Refactor for each occurrence or Replace All.
In Android Studio (ver.3.1) shortcut for Refactor/Rename is: Shift+F6.
ctrl + R in windows,
it works for me
I also faced the same problem a few days back, just go ahead to refactor the variable and when the popup appears to confirm the refactoring the variable just uncheck the "Search in comments and strings", and it should work.
You might have some software running in the background that catches the event and isn't firing it back at the system for other software to process it.
One example, and a very popular one, is GeForce Experience In-Game Overlay (Shadowplay). Shift+F6 is used by it to switch post-processing filter slots.
If you happen to run a device with an nvidia chip, you probably have it running.
Steps to find and fix the issue:
Open its settings:
Alt+Z by default, or
RMB click its icon in the tray -> GF Experience -> Gear icon in the upper-right corner -> Scroll down to In-Game Overlay -> Press the Settings button.
Click the Gear icon on the right.
Keyboard shortcuts.
Find Shift+F6, click, press Delete on your keyboard.
If that software is not running in the background, it may be something else but equally as "greedy" is running then. Look for it in the tray. Good luck!

How to debug Android project

I'm new to the Android framework (using Eclipse) and I have a question about debugging. Recently I did this error in an activity:
// The installation button
Button button = (Button) findViewById(R.id.preparationInstallButtonID);
button.setOnClickListener(this);
setContentView(R.layout.preparation);
i.e. I tried to add an onclick-event prior the layout had been rendered. This crashed the program, "Sorry, the application xxx has stopped unexpectedly". Running it again, with debug-mode, Eclipse opens a Debug-window containing "Thread<3> (Suspended)" etc (I'm sure you know which window I'm talking about).
Now, how am I able to extract useful data here? Regarding the problem above I found how to fix it by trial-and-erroring, but let's say I'm not able to do trial-and-error, how can the debug-window help me find the source of the error? It says "exception RuntimeException", but I don't see any pointers as of where in my code the exception occured.
If You want to debug:
Right click left of Your part of code You want to debug (at line number). select Toggle Breakpoint.
You can see small circle beside the line number, that is the breakpoint.
Then, make run configuration, click small arrow beside run icon, and click 'run configurations..'
Click on android application, you will see this dialog window:
Read it, "highlight" this: 'Press new button to create a configuration of the selected type'. Click the New button, above the tab, You will see this dialog:
fill it, browse Your project,
for example, I add Scrumptious project, and launch default activity. Click on Target Tab, choose Your emulator. If You want to run on physical device, click 'Always prompt to pick device'. I run on physical device this time,
for the Common tab, if maybe You want to check Display in favorites menu for 'Debug' or 'Run' option. It is optional. Click apply.
click debug icon - and select your project. If You activate 'Debug' on Display in favorites menu, the project will shown at the debug option menu.
I choose 'Always prompt to pick device', this dialog will shown. I want to run at physical device, so I click the device at the 'Choose a running Android Device', and click 'Ok'. You can also run on emulator. Just click your emulator, and click Ok.
If eclipse give confirmation to open perspective, select Yes
Then, if You want to know what is value of the variable, just put your mouse to the instance of variable, or You can browse at 'Variables' window at Debug perspective.
Use the LogCat this will give you the error messages and everything else that goes on in your testdevice/emulator.
Window -> Show View -> Other -> LogCat
I strongly recommend this tutorial on debugging in general.
http://www.vogella.com/articles/EclipseDebugging/article.html
It takes you through all the features Eclipse offers in that department and is well worth the time.
As far as the particular trick that might've helped, it might have been useful to set a breakpoint (i.e., clicking in the left margin of the code to make one of those blue pins appear). Then, when running in debug, you could stop near where the problem occurred, and step forward, beat by beat, using the "step into," "step forward," and "step return" commands at the top of debug window. While you're stepping around the code in that way, you might have the variables window open, so you could see what things are set in a manner they should be, etc.
Alternatively, you could set a breakpoint on RuntimeException (even one that's caught), by clicking on the Breakpoints window in debug, and then licking the "J!" button (the mouseover text shows "add Java Exception Breakpoint."
The debug view lets you do other cool stuff too, like:
letting you set "watchpoints", so you can see when the application changes relevant fields, etc.
"Drop to frame" so you can start your app in the middle.
Set up step filters, so that "stepping" through I mentioned earlier can be done more efficiently.
Create a detail formatter, a little snippet of java code that formats the output of a field so you can view it more cleanly in the debugger.
And much more!
Again, I recommend the above-referenced tutorial. And welcome to the wonderful world of debugging.

Categories

Resources