• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Android - update SQLite

 
Greenhorn
Posts: 8
Android Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a simple application that supports SQLite.
How to upload new versions of applications that are not deleting, just update the database?
 
Rancher
Posts: 436
2
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have a look at the SQLiteOpenHelper. You can implement methods for upgrading/downgrading, so the thing happens semi-automatic.
 
author
Posts: 38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I haven't looked at this aspect in any seriousness. But this is a good question.

The sqlitehelper has the supporting methods but one needs an approach how to use those methods to get what you want.

I will do some research and let you know.

Satya
 
Andrzej Sydor
Greenhorn
Posts: 8
Android Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Further the question of why examples from the book:
"Professional Android Application Development 2"
do not work.

Downloading code from Chapter 7, which run in the Eclipse and the Android emulator, and I have exceptions.
Why?

Thanks for your interest in the topic!
 
Hauke Ingmar Schmidt
Rancher
Posts: 436
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andrzej Sydor wrote:Further the question of why examples from the book:
"Professional Android Application Development 2"
do not work.

Downloading code from Chapter 7, which run in the Eclipse and the Android emulator, and I have exceptions.
Why?

Thanks for your interest in the topic!



You should open an extra thread for this. But please TellTheDetails there; ItDoesntWorkIsUseless, it is not giving enough hints for us to help.
 
Satya Komatineni
author
Posts: 38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Andrzej,

Thank you very much for pointing this out.

I encourage you to contact us for anything like this.

Let me see if I can solve your chapter 7 problem first and then I will address why Pro Android 2 has a problem compiling.

You can access zip files chapter by chapter that you can directly import into eclipse.

Here is the link

Pro Android 2 Downloadable Projects

From this link download the zip file for chapter 7 and you should be able to import into your eclipse ADT. Just to be cautious make sure you are at a higher API level such as 2.3 or so.

if you can't you email me or Dave directly and we will help you out. (Infact I encourage it)

Now coming to why stuff may not compile in ProAndroid2 book:

1. For space saving in many places I haven't included the imports, leaving the eclipse ADT to fill them in. This leaves some discrepancy with package names in the android manifest file that needs to be fixed by hand.

2. With so many chapters and so many examples we have missed to include some XML files. Even with two editors checking things got missed. [Note: It is exteremely hard to present code that can compile right out of the book]. So in book 3 we have provided downloadable zip files so that we may be excused for our follies in the text of the book.

we worked hard to correct this in Pro Android 3

1. We have made a practice to include the list of files where we present examples. This acted as a cross check for us to make sure we dont miss any thing
2. Our technical editor Dylan has put extra emphasis to compile them
3. We have given the zip files on the website for downloads
4. All samples/examples in Pro Android 3 can be found here Pro Android 3 Downloadable Projects

If I can say one final thing, contact us if you can't compile. It is the easiest and the least difficult thing for us to help you on those.

Appreciate again your support

Satya
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you write code in your update method for the database, you have to write the alter table scripts, or drop tables, but when you set the version number to a higher number than what was before, the update method will be called. Just remember you have to do all the work yourself writing those ddl statements. Testing it out before putting it out is extremely highly recommended.

Mark
 
Andrzej Sydor
Greenhorn
Posts: 8
Android Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have :
Professional-Android-2-Application-Development

Link for the source code:
http://www.wrox.com/WileyCDA/WroxTitle/Professional-Android-2-Application-Development.productCd-0470565527,descCd-DOWNLOAD.html

This Chapter 7 is not correct.

The link:
Pro Android 2 Downloadable Projects
http://www.satyakomatineni.com/akc/display?url=ShowAttachmentsIMPURL&reportId=3468&downerUserId=satya&order_by_format=name

is a book for Professional-Android-2-Application-Development
I have a Android 2.1 (LG GT540)

Evening I will give more information
 
author
Posts: 51
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry Andrzej, some confusion on our part. Our book is Pro Android 3 and it's being featured this week in this forum. So when Satya saw your post, he thought you were referring to a problem in chapter 7 of our book. But you're talking about Reto Meier's book. You could try reaching him directly through his blog: http://blog.radioactiveyak.com. Hopefully he will help you fix the problems.

- dave
 
Andrzej Sydor
Greenhorn
Posts: 8
Android Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can we get simple/example application which use SQLite?

I need application where in folder 'assets' a have database SQLite, when i install on Android, then copy/update the database in phone.

And i can run sql statement 'select/update/insert' ?

(Android 2.1) !!!
 
Dave MacLean
author
Posts: 51
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In chapter 4 of Pro Android 3, Satya covers how to create a new SQLite DB using DDL within the Android application. The sample code for our chapter 4 can be found from http://www.androidbook.com/projects. But it should be possible to copy files from assets within your APK to the /data/data/<yourpackage>/databases directory to use them from there. Here are a couple of posts on stackoverflow.com that you might find useful:

http://stackoverflow.com/questions/4434367/copy-my-own-sqlite-db-from-asset-folder-to

http://stackoverflow.com/questions/4989300/having-problem-while-copying-sqlite-database-from-assets-to-data-folder

- dave
 
That is a really big piece of pie for such a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic