Wirelessly how to refer to the code for finding and referencing others (to be perfected and to be amended)

Source: Internet
Author: User

1. API

Many demos have been provided in the official Android documentation, which can be used in the case of unknown controls.

2. System Source Code

System source code is the best teacher, through a step-by-step click, enter the system source code. Or we need to call the system's activity of an application, can directly look at the system source code

General View source code has the following several ways

1) in your own code directly CTRL + right mouse button, click into the direct view, this method is suitable for just a simple view of the system in the API described in the implementation of the logic

2) go directly to the source to see, more suitable for Android engineering files are quite familiar with the engineer, general view is first from the resource list file, the system source comparison has characteristics, English a little better, to be able to express the meaning of the direct search list file, For example, to open the main page of the System Launcher application, then the path is in .../packages/apps/launcher2, it is best to be very familiar with the composition of the Android project, so in the flip, you want to search for what, positioning will be very clear

3) New project, from the System source code import (or to the Android project and Android system source code of the organizational structure have a certain understanding, after the introduction of the project will generally be wrong, but this is not our concern, we are not compiling source code), by searching for keywords, generally we search the way or operation steps are as follows: ( Universal Search in Eclipse Direct shortcut key ctrl+h can)

I. See the contents of an activity in the system, this thing even with feet think, also in Values/strings.xml, is the dynamic change of some values (except for the value), are in this (internationalization)

II. By finding the vlaues, then you see the corresponding name,name is usually referred to in the layout file, but also in the Java code (this is more special), then directly search the name

III. Android General situation, then this is to see the background there are values and layout files under the file, layout of the file is our concern, open the layout of this file, see the control's ID, re-search ID

Iv. search for the ID, open the corresponding Java file to see, all the way ctrl+k, navigate to the logic of processing

V. Code logic to understand, copy and paste, error is likely to be the underlying hidden methods, hidden methods, is elusive? No, just use the way special point, with reflection is not done?

3. Refer to someone else's code

1) View System background Log

In general, when we see an application calling the activity of the system, we are curious about what kind of intent he sends, what will be shown in the Logcat, and it would be easier to use this approach in order to achieve this.

2) Anti-compilation

Anti-compilation is a good way to use anti-compilation when you need it.

The following scenarios are typically used to decompile

(1) to refer to pictures of other applications

(2) to refer to the layout of other applications

(3) to refer to the logical processing of other applications

For the above several requirements scenarios, our processing methods are as follows:

Just get the picture processed:

Pictures in the Android app is not a private thing, to get to the words, very simple, download directly to the other app apk file, that is, install the package, the suffix name is modified to. zip, unzip open, in the res/drawable*** file, this is the corresponding picture

Referencing the layout of other apps

To refer to the layout, it is necessary to use the tool, can not be easily used to get the image of the processing method, the use of apktool this tool, the following steps:

Enter the Apktool directory, open the console, enter the following command Apktool D corresponding apk full path and file name can be unpacked, in Apktool file found a new folder, the name of the same name as the APK, this is successful, you can view the layout file

Referencing program logic for other applications

Also requires tools, Dex2jar and GUI

Operation Steps:

Modify the apk file suffix to zip

Unzip to find the corresponding Dex file

Convert the Dex file to a jar file, use the Dex2jar command Dex2jar Classpath.dex and then the file is automatically converted, the resulting file is located in the Dex2jar directory

Open the file using the GUI (this is just unencrypted file processing, has been encrypted, then we need to learn to learn Smali language, to analyze the file)

Wirelessly how to refer to the code for finding and referencing others (to be perfected and to be amended)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.