I created an UI for my Android Project. However I was wondering whether it is possible to create a library out of it so that you can sort of “load” the UI in the onCreate method of my Activity.
I read about putting my created classes into a .jar file, however what about main.xml where my UI is built they way it looks.
If I could actually load the UI it should be possible to add tweaks to the UI for the same Activity if someone for example likes a different design of his app.
I hope you can help me out.
You can create a library project.
Typically it’s not easy to arrive at a simple JAR, although this is a much complained about limitation!
So just import your “library” project in any other project you would like to reference.
I’ve personally created a few extensions of the Activity class where setContentView is already called in onCreate.
In your application project just extend your custom activity from the library project.