If you frequently read the source code during the learning process, you will have a deep understanding and a high learning efficiency. How can you easily and quickly read the android source code?
How to view the android source code [take android2.2 as an example]
We know that in eclipse, you can press the ctrl key and click the left mouse button on a class to jump to the files of this class. If no source code is available, the system will jump to the class file. Therefore, we only need to copy the source code to the appropriate location, and eclipse can find the source code. Next, let's take the following steps:
Download the android-2.2-froyo-src.zip source code and [decompress it] It in the specified directory of the android SDK. The directory on my machine is: C: /androidsdk/Android-SDK-Windows/platforms/Android-8/sources, where the sources directory is self-built. After decompression, it should be like this:
After that, restart eclipse, open an android project, and press Ctrl to click activity. In eclipse, check whether the source code is displayed?
How to view third-party component source code [Taking ormlite-android-4.22.jar and ormlite-core-4.22.jar as an example]
We first download the corresponding [source package] and [help documentation package], respectively: ormlite-android-4.22-sources.jar, ormlite-android-4.22-javadoc.jar and ormlite-core-4.22-sources.jar; ormlite-core-4.22-javadoc.jar, add a lib folder in the project to store the jar package. The project directory is as follows:
The steps are as follows:
First: in the referenced libraries directory, right-click the third-party component package [ormlite-android-4.22.jar
] --> Build path --> Configure build path...
2. In the pop-up attribute box, follow the steps shown in the following figure:
In the source attachment Configuration box, click the external file... button to select the location of the source code, remember the ormlite-android-4.22-sources.jar package under the/lib directory. Click OK.
Third: Add a help document package. Operations include:
In the javadoc for 'ormlite-android-4.22.jar 'properties box, click the Browse button to select the help document package, and then click OK.
4. After the above steps, you have completed the settings for adding third-party component source code and adding and setting the help document. In this way, you can view the source code of a third-party component just like viewing the android source code. At the same time, you can locate the cursor to a class in eclipse and press the F1 key to view the corresponding help documentation. PairOrmlite-core-4.22.jar
The operation is the same.
^-^ This is the end of today.