Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Cache android

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I wish to create a sign up page i have to display country names and state names.
Country names and state names are static data.
Is it a good idea to store the country names in Strings.xml file or storing in SQLite data base or any better ideas are there to handle cache.
 
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well you can dynamically add to the SQLite database when the program is compiled and running. So you could create a web service to update the values and then consume those values with you app.
On the other hand, if you use Strings.xml then you need any time that you want to update those values you have to provide a new version of the app.
It is probably easier to work with String.xml then to work with SQLite.

Are you planning on localizing the values for non English regions? Strings.xml handles this for you with little work, however with SQLite I suspect it would be more work.

You stated that the values would be static, however some times people do make typos or you may want to open this app to other regions.
With SQLite and a web service this would be fairly easy, but with Strings.xml you would need to roll out a new version of the app.

The amount of data that you work with also factors here. If you only have one or two countries and a small.
For example USA and Canada and only their states and provinces then you are looking about about 65 entries or so and this would be fairly easy to handle in your app with Strings.xml
On the other hand, with many different countries and regions I would suggest SQLite.

If you are sending this data to an external detestation  like a web service then you may want to use SQLite if you are sending primary key values such as a number.
Then you could make these values the same on your app and at the detestation.

One other factor could be how comfortable you are with SQLite and getting the data to and from the data source.
I don't know if there is one clear winner here as either/both can be used.
 
mohana krishna
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pete Letkeman,

Thanks for your reply.

In future, my app has to be implemented in different countries also I may have to store the values for Citi also.

So as per your suggestion, it would be better to use SQLite with web service.

Suppose if there is a new country or State or City added on host how can android app aware about new changes.

I guess solution will be when user open the app a web service call has to be happened to know any new changes is there on the host.

If there are any changes then the host has to indicate that there are some changes on the host.

The app has to consume the respective web service to get the latest details.

Is there will any easy or better solutions than one I have mentioned.

Thanks,
Mohana Krishna.
 
Bartender
Posts: 7488
171
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Suppose if there is a new country or State or City added on host how can android app aware about new changes.


As you indicated, one approach would be for the app to check for data updates when it is started. Another would be for your server to use Google's FCM to send a notification to the device that there is new data, which the app can then retrieve at its leisure.
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cannot think of a better general idea/implementation then what has already be stated in the previous post by Tim or you.
 
mohana krishna
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim Moores and Pete Letkeman,

Thanks for your time and suggestions.

Regards,
Mohan.
 
Pete Letkeman
Bartender
Posts: 1868
81
Android IntelliJ IDE MySQL Database Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm glad that I can help you out. After all we are all in this together.
 
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic