• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Cache android

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
  • 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
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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.
 
Saloon Keeper
Posts: 5588
144
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • 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
  • 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
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
I'm glad that I can help you out. After all we are all in this together.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!