Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make IntelliJ/Android Studio open Android docs when clicking F1 on function?

Let's say I have the following line of Android code:

MyClass myClass = (MyClass) intent.getExtras().getSerializable("SomeKey");

How can I make IntelliJ/Android Studio open a browser and navigate to the following URI when hitting F1 while the cursor has marked "getSerializable"?

http://developer.android.com/reference/android/os/Bundle.html#getSerializable(java.lang.String)

Is there a plugin for this maybe?

like image 946
Nilzor Avatar asked May 30 '13 13:05

Nilzor


People also ask

Can I use Android Studio on IntelliJ?

Are Android Studio projects compatible with IntelliJ IDEA? Yes, the two IDEs use the same project format.

Which is better Android Studio or IntelliJ IDEA?

Android Studio may be a better choice for businesses that develop primarily Android Applications. It is worth noting that Android Studio is based on IntelliJ IDEA, so for businesses that develop for multiple platforms, IntelliJ IDEA still offers some support for Android development in addition to other platforms.

Is IntelliJ IDEA faster than Android Studio?

TL;DR: Android Studio (3.0 version and after) takes a lot of RAM and it's lagging, IntelliJ IDEA is way faster.


2 Answers

Open up Project Structure window and then go to Libraries and point to the android jar:

enter image description here

Now press the green plus sign:

enter image description here

Choose the Specify Documentation URL... option:

enter image description here

Enter the Android SDK API url:

enter image description here

Press OK all the way back so you end up in the editor again. Now place the caret at the method and press Shift+F1:

enter image description here

The browser will open up and navigate to the correct page.

like image 165
maba Avatar answered Sep 29 '22 20:09

maba


In my Android Studio 1.5.1 installation, the libraries are listed in the Structure View once I select my module from the Project View and select Android from the drop-down as shown in this link:

Click >> Project View and Project Structure View

Now right-clink on the library you want to add URL to and select Library Properties. A window will popup with a button Specify Documentation URL and you can paste your URL there.

Click >> Library Properties windows and Documentation URL popup

Now you can go to the code editor, select any element you want to see documentation for and press Shift+F1 and browser will open up with the corresponding URL.

like image 30
Mayank Gupta Avatar answered Sep 29 '22 19:09

Mayank Gupta