0

I'm newbie on android and I have two question but first Let me explain you the application I'm working on it.
In the Application I will have Some Text 'Like quotes they will be rarrely changed only between Version'

  • So What's better in this case to store those Text in simple string and call them at onCreate or onStart activites ?

The seconde part of application, it's like an alarm but in stead of setting time manually it will get data from internet every day so data will be changed everyday.

  • So in this case what's better to store data in string or database (Those data will be shared with service that will play notification when it's time ).

Sorry If there's no code in my post but I need to know the right way to do it and best desvelopement practice.

Chlebta
  • 3,090
  • 15
  • 50
  • 99

2 Answers2

1

I think you could use SharedPreferences if you need only to store strings

Shared Preferences in Android

Community
  • 1
  • 1
GioLaq
  • 2,489
  • 21
  • 26
1

If I understood correctly, there is no need of databases here. In the first case, if the quotes will just change by version, you can easily store it in string literals. No hastle of databases.

In the second case, you can set alarm when you are retrieving time data from the internet. Or you can also store those in a simple file in SD card, or in SharedPreferences. It will be relatively easy I think.

muntasir2000
  • 204
  • 1
  • 3
  • 11
  • For the seconde case, as I told you it will be like alarm so do I have to create service to do that or there's another way ? Also are SharedPreference not destroyed onDestroy action – Chlebta Oct 20 '14 at 21:52
  • 1
    No. Sharedpreferences will not get desteoyed on onDestroy(). You can use AlarmManager to schedule a timed task to periodically check for data on the internet and set alarm in the same time. And yes, you can start a service for that. – muntasir2000 Oct 21 '14 at 08:58