Creating CustomViews as a modular and reusable component that can be used in projects

I am currently developing a fairly large-scale Android application. As part of the application, I created a custom view (one of many).

The user view in the question is quite wide, in terms of functionality, and because of this, there are many layouts, resources and attracted means for responding to various devices, orientations, resolutions, etc.

How can I separate this functionality so that it can be developed in isolation and not pollute resources in the rest of the project. (Also make it available for project sharing without the need to untangle resources).

I hope that it is possible, one way or another, β€œsomething”, but to be afraid that it may be impossible. It would be great if someone had any strategies to achieve this.

+4
source share
1 answer

You probably want to see the Library Project .

It allows you to share code and resources between applications.

From here :

An Android library project is a development project that contains common Android source code and resources.
Other Android application projects may reference the library project, and during compilation include its compiled sources in their .apk files. Multiple application projects can reference the same library project, and any application project can reference multiple library projects.

+7
source

Source: https://habr.com/ru/post/1387546/


All Articles