database update

by Dan » Fri, 26 Feb 2010 00:40:30 GMT


Sponsored Links
 I've got a question about updating an app after release.  If I have a
database that contains 10 columns and I add a feature that requires an
11th column after the app has been released, where would I put the sql
code to add the new column so that when they install the app it keeps
their current data, but adds that 11th column?  Is that even possible
or would I need to create another table that references the first with
a foreign key?

--



database update

by Mark Murphy » Fri, 26 Feb 2010 00:45:06 GMT


 


In onUpgrade() of your SQLiteOpenHelper subclass.

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

Warescription: Three Android Books, Plus Updates, One Low Price!

--


Sponsored Links


database update

by Kevin Anthony » Fri, 26 Feb 2010 01:53:55 GMT


 Alter
 http://www.techonthenet.com/sql/tables/alter_table.php 

Kevin




I've got a question about updating an app after release.  If I have a
database that contains 10 columns and I add a feature that requires an
11th column after the app has been released, where would I put the sql
code to add the new column so that when they install the app it keeps
their current data, but adds that 11th column?  Is that even possible
or would I need to create another table that references the first with
a foreign key?

--



database update

by Dan » Fri, 26 Feb 2010 04:35:36 GMT


 thanks, so the onCreate gets called when the database has not been
created and the onupgrade gets called when the database has been
created, but the app is being upgraded?  Do these methods get called
due to some global variable that gets reset upon a fresh or upgraded
install of the app?






--



database update

by Mark Murphy » Fri, 26 Feb 2010 05:24:47 GMT


 


Yes on the first. More accurately for the second, onUpgrade() will be
called when the schema revision (parameter in the SQLiteOpenHelper
constructor) changes.


No, they get called when you ask your SQLiteOpenHelper subclass to
getWriteableDatabase(), for example. The determination of whether an
upgrade is needed is based on some metadata tucked away in some corner
of the database.

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

Warescription: Three Android Books, Plus Updates, One Low Price!

--



Other Threads

1. Voice Recognition Libraries - Open Source?

I have an application, Twitoc, in the market that uses Google Voice
Recognition to send Tweets to Twitter. The application only works for
Android 2.1+ as I believe that is the only platform that has Google
Voice recognition libraries pre-installed (I may be wrong). I found
that it works on Android 1.5 if you install
"com.google.android.voicesearch". I found this package from a third
party website but I believe it is available in some Android Markets
for download (Not Canada as far as I can see).

http://uk.androlib.com/android.application.com-google-android-voicesearch-jwAq.aspx

My question is that if I find a way to incorporate this into my app,
am I allowed to to redistribute it with proper attribution to Google?
Is it open-source?

I appreciate a response as this would allow me to make this
application available to all devices!

Thanks,

Matthew Patience
Mobicartel

-- 

2. Mapping Multiple textures to a cube in Android OpenGL ES

No, that's not what cube maps are for.

You can only draw 1 texture at a time (unless multitexturing but
that's totally different and not what you want) so you have 2 options:

1)  Combine all textures together into a single one and map the
coordinates to each side accordingly (will run much faster)
2)  Draw side-at-a-time binding to the appropriate texture for each
side. (not usually the preferred method.)

A trick many of us use when doing something like... say you want to
have the user pick 6 photos from their SD card and then you want to
display those on a cube, one on each face.  At some point you must
load each photo up, clipping and scaling it to fit aspect ratio and a
power-of-two texture and then uploading it to vram.  Well, instead of
uploading each one as a separate texture, why not just create a
1024x1024 bitmap and draw all 6 photos to it in different spots.  You
could use 50% of the texture vertically and 33% horizontally (for
example) to pack 6 photos onto it for 100% usage.  It's ok if they
distort going on to it so long as you draw them aspect-correct.  You
then keep track of which one is where (using UVs, so percentages from
0 to 1).  Upload that texture atlas as a single texture and when you
draw your cube, you just bind to that atlas once and draw everything
in one shot.  It'll run fast and it's not really that hard to do.




-- 

3. OOT paging Abangkis mw tanya seputar badminton

4. Android SDK and Helios - compatibility problems?

5. why is there no android tablet nearly as good as ipad?

6. Track user location.

7. UltimateFave