I have been messing around with Android Studio and so far I like most of what I have seen. One thing that has been annoying me though is this lack of "Table of Contents" for a class. I apologize for not knowing exactly what to call it. But what I am referring to is the dropdown menu in eclipse that lists all the methods, interfaces, classes and so on that are in that class file. This then allows you to jump to that position. This view is when you are in "Package Explorer" and click the arrow to the left of the class. This is one thing that makes me really miss eclipse. I know that you can easily search with Ctrl+F inside a document but I often forget the method names. I tried looking through here but to no avail. Just wondering if anyone knows some way to handle this.
IDEA has a tab called "Structure", which shows all the methods, fields, etc. of the currently-open class.
I've just got a Tip of the Day popup in Android Studio helping with exactly this problem.
You can quickly navigate in the currently edited file with
Ctrl/⌘+F12 (Navigate | File Structure).
It shows the list of members of the current class. Select an element you want to navigate to and press the Enter key or the F4 key. To easily locate an item in the
list, just start typing its name.
Also, as danny117 points out, you can use Alt/⌘+7 to show / hide the same content in a side panel view (shown above in Chris Jester-Young's answer).
View > Tool Windows > Structure
In addition to what Chris Jester-Young said, it's worth pointing out how to see the methods and properties of a class pointed by the cursor.
a) Type Ctrl + H in the class pointed by cursor.
b) In the class name, in the hierarchy window, double-click the class name. The system, upon confirmation, will decompile and open the class code.
c) Alt + 7 (Windows) or Command + 7 (MAC) to display the structure window.
d) One can now visualize properties, methods, derived classes, derived interfaces, and even include inherited items. All related to the class under the caret.
I'm currently using Beta 0.8.9 of the Android Studio and what you need to do is click on the settings icon in the Android Project View. If you select 'Show Members' then the Classes become expandable and you can navigate around the class using the project view.
Related
when I select a widget say a Text widget in android studio, I hit on alt and enter to generate a code. For example, you can wrap a widget inside a column with this combination but in my case, this combination suggests me things like : generate getter and setter or toString() method which definitely come from java. Now you might say, you have to change your key binding then but that is the problem, on keyboard shortcuts section, I see only one section where I can assign a combination. But then this happens where I only get code suggestions for java. How could I possibly change that?
Alright, so I found the solution, when you check the keyboard shortcuts, you gotta find show context actions and assign a key binding to it, then it is fixed.
I was wondering if there is a shortcut in Android Studio to jump to parent class from current file?
There's a keyboard-shortcut for Go To > Definition (my personal favorite).
select any class-name bei double-clicking it and then hit Control+B.
For the super class, just select the class-name which follows extends.
And there's even a direct shortcut: Go To > Super Class.
place the cursor inside the class definition and hit Control+U.
Alternatively, simply click the "overridden method" icon:
This has the advance, that one does not have to search for the overridden method.
Source code navigation describes these and many others.
(that's also the source of the above image).
I am looking for Breadcrumb functionality like Eclipse in Android Studio.
In Eclipse Breadcrumb shows "method signature" when pointer(cursor) come inside whereas in Android Studio Breadcrumb is good for nothing.
Please find attached for better insight.
The accepted answer is not correct.
The feature is still here in 2018.
It's under View -> Active Editor -> Show Breadcrums.
The breadcrums are situated south of the current editing window, not north as in Eclipse.
You can enable it via View -> Navigation Bar and check it.
But it will show breadcrumb/navigation upto class only and not upto the method signature.
As suggessted by AVEbrahimi also, ctrl+F12 will show method signature.
Seems this feature gone away.
You should use:
Ctrl+F12 OR CMD+F12
Here are two ways to see the method signature through a tool tip that hovers next to the method you have selected or put the caret on.
Press ctrl + P with the method selected.
or
Go to View > Show Parameter Info with the method selected.
I found the above solution on the second link I looked at after this one. The link was for a different IDE but the hotkey works in Android Studio.
Show Parameter Info
Also, you can go to Settings > Editor
Under "Other" check "Show quick doc on mouse move". This will show a popup tool tip with information about the method including parameter info.
Found that here:
View method information in Android Studio
Pressing Alt+Q displays the name of the current context, which is actually the method name (Context Info) quickly and easily.
I have to make a documentation for my program, and that documentation have to contains class diagrams too.
My problem is, some method has too many parameters, and it makes the class diagram very long horizontally. And these large diagrams doesn't fit in the documentation.
Is there any way to break the line of the parameters? (I tried ctrl+enter) So the method will take place two lines, and it won't be that large horizontally.
How to resize the class elements in VP
For already existing classes:
Right click on the class - not on a class element.
On Popup menu choose Presentation Options -> Configure Class Presentation Options
Check Wrap Members , OK
Change the width of the class box and be happy.
For new classes from now on:
Tools-> Project Options->Diagramming->Class->Presentation
Check Wrap class Member, OK/Apply.
If you don't see some options
Go into Tools -> Application Options -> General -> Environment, check Advanced UI mode, apply and restart the whole application.
You can also divide a line by hand, using Alt+Enter
The Visual Paradigm documentation says to use Ctrl+Enter but on a OS X at least, it is opt+return.
Note that experience has shown that if you hold down opt too long before pressing return it will activate a menu shortcut mode*. When this happens it also leaves edit mode so hitting return at that point has no effect.
So on OS X be sure to hit return immediately after pressing down opt.
You can change the key sequence for line breaks on OS X by going to Windows -> Application Options -> Diagramming, and changing the drop-down value for "Create new line key".
*I tried several different Google searches to find the Visual Paradigm documentation that explains this "mode" but didn't have any luck. I invented the term "menu shortcut mode" to describe it.
I work in VS2012 and would like to organize the order of members in a class by drag-and-drop, like I can in Eclipse.
However, the members outline in a right-top of the screen and also in a class view or in solution explorer do not give such an option.
Is there a way to do it?
Code Maid is a free Visual Studio extension that adds a digging window tool.
This will answer to your needs, I believe.
This tool also allow you to reorder code elements with drag & drop directly within this window.