Solution: how can we reuse resources between Android projects?

Source: Internet
Author: User

When developing a projectCodeIt needs to be reused, and many resources are often reused, such:

  • Icon on the button
  • Interaction sound
  • Activity layout required by a function
  • Widget Style
  • Common text and corresponding language versions

For example, the layout of such a software sharing:

The layout, labels, and button text are reusable. If you share a link to the author's Software List, QR code images can also be reused, you only need to pass in different sharing information strings for each call.

Now the problem is that I cannot find a way to share these general resources among multiple projects. Currently, I can only copy and paste these resources among projects in a very straightforward way. I always feel like this ......

 

I tried to use a project as a public project, store resources, package them as jar files, reference other projects, and use the resource ID in the public project namespace to access resources, but in this way, the access is still the same as that ID in the project (because ID is actually an int value). This problem must be because the context still usesProgram, So I found it directly from the resources of the program.

Then I try again through this. createpackagecontext ("com. skyd. common ", 0) to obtain the context of a public project, but this operation fails. The exception prompt name is not found, and this method is effective across app calls.

 

Is there any way to achieve this?

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.