Android Simple to modify the original application and add the application method _android

Source: Internet
Author: User
Tags sqlite database

The examples in this article describe how Android simply modifies the original application and adds the application. Share to everyone for your reference, specific as follows:

The first part: How to modify the original Android application

1. Start with a new Android project, load your own Java files and resource files.

2. After the successful initial commissioning of your Android project, copy the Java files and resource files from the project to the Java file and resource files directory of your contacts.

3. Execute the following command under Linux, compile the contact module, compile the resource file into the contact directory

. build/envsetup.sh
mmm packages/apps/contacts

4. Refresh the Android source project, this time you can in the contacts package directory to see your new resource files and source files, and can be modified under the source code and direct debugging.

5. After the source project has been modified, you can execute the contact compile command again under Linux, make Snod load the system.img file, and start the emulator (emulator &) so that you can see your changes.

Question: Why do we need to compile the XML resource files in Linux first?

A: Because our Android source project is imported in Java Engineering, if you add an android XML file, the Java program cannot identify the resource R file, so we must first compile the required XML resource files in Linux.

Part Two: How to add a new Android app

1. Verify that the SDK directory is the same as the system version, and then develop your own Android application under the SDK directory.

2. Create an Android project under the packages/apps/directory of the source code.

3. Add a android.mk file under the Engineering directory, modify Local_package_name to designate the project name as its own command project name, if my project name is test, then local_package_name:=test.

Local_path:= $ (call My-dir)
include $ (clear_vars)
local_module_tags: = User
Local_src_files: = $ ( Callall-java-files-under, SRC)
local_static_java_libraries: =googlelogin-client
local_package_name: =test
local_certificate: = Shared
include $ (build_package) # Use the folloing include to make our
testapk.
Include $ (callall-makefiles-under,$ (Local_path))

4. Return to the source directory first, and then execute. build/envsetup.sh ( Notice the space after SH )

5. Execute mmmpackages/apps/test001 and compile test001.apk package

6. Execute make Snod and compile system.img package, then execute Emulator &

This allows you to see your own compiled projects under the application.

More interested readers of Android-related content can view the site: Android Development Primer and Advanced tutorials, the Android View View tips Summary, the activity tips summary of Android programming, Android Operation SQLite Database skills Summary, "Android operation JSON format Data Skills summary", "Android Database Operation skills Summary", "Android File Operation skills Summary", "Android programming development of SD card operation method Summary", " Android Resource Operation tips Summary and the "Android Controls usage Summary"

I hope this article will help you with the Android program.

Related Article

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.