Re: [android-developers] update app without deleting DB

2011-01-10 Thread kavitha b
I hope you can use OnUpgrade method of DB when upgrading the app

On Sun, Jan 9, 2011 at 9:15 PM, Mark Murphy  wrote:

> On Sun, Jan 9, 2011 at 10:37 AM, Alex  wrote:
> > Simple question :
> > I published an app (2months ago). It uses a DB to retrieve
> > information, and the user saves some parameters in the DB.
> > Now, I want to update my app, that means : I want to put more
> > information in the DB but without erasing parameters set by the user.
> >
> > How can I do that ?
>
> Write Java code to "put more information in the DB but without erasing
> parameters set by the user".
>
> For example, if you are using SQLiteOpenHelper, increment the version
> number of your schema. That will cause onUpgrade() to be called in
> your SQLiteOpenHelper subclass the first time your app is run after
> the upgrade. There, you can execute whatever code you want to adjust
> the schema and/or data in the database.
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android Training in London: http://bit.ly/smand1 and http://bit.ly/smand2
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] update app without deleting DB

2011-01-09 Thread Mark Murphy
On Sun, Jan 9, 2011 at 10:37 AM, Alex  wrote:
> Simple question :
> I published an app (2months ago). It uses a DB to retrieve
> information, and the user saves some parameters in the DB.
> Now, I want to update my app, that means : I want to put more
> information in the DB but without erasing parameters set by the user.
>
> How can I do that ?

Write Java code to "put more information in the DB but without erasing
parameters set by the user".

For example, if you are using SQLiteOpenHelper, increment the version
number of your schema. That will cause onUpgrade() to be called in
your SQLiteOpenHelper subclass the first time your app is run after
the upgrade. There, you can execute whatever code you want to adjust
the schema and/or data in the database.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in London: http://bit.ly/smand1 and http://bit.ly/smand2

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en