r0ber7
r0ber7

Reputation: 329

Android: using XML layout from internal storage

Stackoverflow has helped me tremendously with my projects. Thank you for that. Now here's my problem:

I've made an app for a company. This company has many customers who will be using the app. The company would like to customize the app layout per customer. They would like to change the background color of elements & button images, among other things.

Now, I'd like to:

(Both of these are currently loaded from resources.) Then:

So, the downloading won't be a problem. The storing of the data in the internal storage won't be a problem either. But.

How do I tell the app to use the customized xml layout, which can be found in the internal storage? Up until now I've used this.

setContentView(R.layout.activity_main);

Now, I want to set do the same, but based on an XML found in internal storage.

In addition, I'd like to load images for buttons etc. from the internal storage too, instead of from resources. Right now I use this:

findViewById(R.id.button_x).setBackgroundResource(R.drawable.button02);

So, in short, my question is:

Is there a way to achieve the functionality of the code above, but with files from the internal storage?

Upvotes: 4

Views: 817

Answers (1)

Blackbelt
Blackbelt

Reputation: 157457

probably you can create a XmlPullParser from the file you downloaded, inflate it through the XmlPullParser obect and pass it as paramter to setContentView. doc for XmlPullParser is here. The inflate method you should use is here. I have never triedm, but teorically seems possible

Edit:

A project of @RoundSparrowhilltx can be found here

Upvotes: 2

Related Questions