MIJkema
MIJkema

Reputation: 41

Link local image in javadoc using android studio

Is there a way to include an image in the class javadoc that is local in an Android project using Android Studio?

I would like to add a diagram to clarify the workings of a class. My structure is as follows:

src/main/com.exampe.project/Class.java
docs/images/Diagram.png

Now I would like to add javadoc to the class, linking to Diagram.png.

My code now looks something like this:

/**
 * <img src="docs/images/Diagram.png">
 */
public class Class {

However, the javadoc linking does not work. Is there any way to show the image in the javadoc?

Update:

Apparently, you can use the docroot attribute, but this does not work for the current version of Android Studio. When I change the javadoc to

/**
 * <a href="{@docRoot}docs/images/Diagram.png">link</a>
 */
public class Class {

and click on the link, it can not find the file, because it points to /Applications/Android Studio.app/bin/../../../../docs/images/Diagram.png. It appears Android Studio searches for the image in the install directory of the program, instead of the root of the project. (this is on a mac)

Upvotes: 2

Views: 1222

Answers (1)

Trucomanx
Trucomanx

Reputation: 11

with comment as:

/**
 * <img src="../../../images/Diagram.png"/>
 */

In the case of source with CLASSPATH=src/main/ and code in:
src/main/com/exampe/project/Class.java (java class after 3 directories)

and Java documentation in doc/
docs/images/Diagram.png

Then the output of java doc is here: docs/com/example/project/Class.html

Upvotes: 1

Related Questions