Your SQL open helper probably has something like:
private static final int DATABASE_VERSION = 1;
used like this (funky emphasis mine):
public YourDbOpenHelper(Context context) {
super(context, DATABASE_NAME, null, [[[--->>> DATABASE_VERSION
<<<---]]]);
}
The database version value is stored inside the SQLite database, and is
compared to the value in your code. If the value in the code is greater,
your onUpgrade is called. This logic is contained in the
SQLiteOpenHelper constructror (the call to "super" above).
So, to test your onUpgrade, first run your application and make sure
that database is opened. This will store "1" (or whatever current value
of the constant is) as the database version.
Now increment the version number to a greater value than used before.
Then run your application, and make sure you work with the database.
It's not necessary to use "adb install", just running from Eclipse for
debugging, as usual, will work fine.
-- Kostya
17.10.2010 22:36, Kumar Bibek ?????:
I haven't tried to debug this. Most of the DB upgrades will simple
enough, which didn't need explicit debugging. But, it works. I am sure
it works on the emulator, and it should work on the device as well.
On Mon, Oct 18, 2010 at 12:02 AM, [email protected]
<mailto:[email protected]> <[email protected]
<mailto:[email protected]>> wrote:
Not working for me :( I am stuck.
Thanks anyway.
If I use the mobile device I can't use adb install because it says its
installed. If I use the -r parameter with adb install it make a new
installation from scratch so no upgrade event is fired.
Have you ever tried to do with the device not with the emulator?
On Oct 17, 8:20 pm, Kumar Bibek <[email protected]
<mailto:[email protected]>> wrote:
> This method will be executed whenever your try to initiate a DB
connection.
> Try executing a code which does some DB related task.
>
> On Sun, Oct 17, 2010 at 11:47 PM, [email protected]
<mailto:[email protected]> <
>
>
>
>
>
> [email protected] <mailto:[email protected]>> wrote:
> > Thanks for response.
> > I am trying but I don't success.
>
> > What I do is:
> > -Open eclipse, set a break point inside onUpgrade event
> > -Run emulator.
> > -In a windows prompt I type:
> > adb emu install muPackage.apk
>
> > It runs, and it stop in the constructor but not in onUpgrade
event,
> > what am I missing?
>
> > On Oct 17, 6:53 pm, Kumar Bibek <[email protected]
<mailto:[email protected]>> wrote:
> > > You can do it thru adb install command
>
> > > On Sun, Oct 17, 2010 at 10:15 PM, [email protected]
<mailto:[email protected]> <
>
> > > [email protected] <mailto:[email protected]>> wrote:
> > > > How to install the new apk over the older version?
>
> > > > On Oct 17, 6:34 pm, Kumar Bibek <[email protected]
<mailto:[email protected]>> wrote:
> > > > > You just need to increment the database version number.
Install the
> > new
> > > > apk
> > > > > over the older version. It will be called just once.
>
> > > > > On Sun, Oct 17, 2010 at 10:02 PM,
[email protected] <mailto:[email protected]> <
>
> > > > > [email protected]
<mailto:[email protected]>> wrote:
> > > > > > Hi, how can I emulate an onUpgrade call for my
SQLiteOpenHelper
> > class?
> > > > > > I have tried changing the version number in my
SQLiteOpenHelper
> > class
> > > > > > and versionCode in manifest but onUpgrade is not called.
> > > > > > Any idea? I need to check my onUpgrade code before
upload it to the
> > > > > > market, I don't want my app's users get a buggy upgrade.
>
> > > > > > Thanks in advance.
>
> > > > > > --
> > > > > > You received this message because you are subscribed
to the Google
> > > > > > Groups "Android Developers" group.
> > > > > > To post to this group, send email to
> > > > [email protected]
<mailto:[email protected]>
> > > > > > To unsubscribe from this group, send email to
> > > > > > [email protected]
<mailto:android-developers%[email protected]><android-developers%2Bunsubs
[email protected]
<mailto:[email protected]>><android-developers%2Bunsubs
> > [email protected]
<mailto:[email protected]>><android-developers%2Bunsubs
> > > > [email protected] <mailto:[email protected]>>
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/android-developers?hl=en
>
> > > > > --
> > > > > Kumar
Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
<http://www.kbeanie.com>
>
> > > > --
> > > > You received this message because you are subscribed to
the Google
> > > > Groups "Android Developers" group.
> > > > To post to this group, send email to
> > [email protected]
<mailto:[email protected]>
> > > > To unsubscribe from this group, send email to
> > > > [email protected]
<mailto:android-developers%[email protected]><android-developers%2Bunsubs
[email protected]
<mailto:[email protected]>><android-developers%2Bunsubs
> > [email protected] <mailto:[email protected]>>
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/android-developers?hl=en
>
> > > --
> > > Kumar
Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
<http://www.kbeanie.com>
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to
[email protected]
<mailto:[email protected]>
> > To unsubscribe from this group, send email to
> > [email protected]
<mailto:android-developers%[email protected]><android-developers%2Bunsubs
[email protected] <mailto:[email protected]>>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Kumar Bibekhttp://techdroid.kbeanie.comhttp://www.kbeanie.com
<http://www.kbeanie.com>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
[email protected]
<mailto:[email protected]>
To unsubscribe from this group, send email to
[email protected]
<mailto:android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Kumar Bibek
http://techdroid.kbeanie.com
http://www.kbeanie.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en