I have android application that is written “regular” way. layouts, java, APK.
Now, depending on some factors I want data to be presented differently to different users with different preferences, etc. Doing it using XML layouts will be very problematic in couple of reasons:
- Upgrade issue – we have bunch of users and they not good at upgrading.
- Hard to maintain and code.
So, I’m toying with idea of “templates” where we can serve templates from server and just use device to generate those.
- Web app won’t work because our data available offline in case there is no connection.
- There is buttons and stuff that user can press to call regular Activities and do things.
I envision something like:
HTML 5 template with {tags} that I will populate from data. I will receive tempaltes and data separately from server. I will merge that data and display on UI.
Now my question is how do I:
- Display HTML5 inside Activity
- Intercept button push in HTML in my Java code?
Is this bad idea to write something like this?
It sounds reasonable to me. You can use a
WebViewfor displaying the content. Your app can manage a cache of downloaded templates and other content and display it in the web view either from the web site or from the cache if offline.