1

I've seen the tutorial for <1MB databases, here, which I've run into the same problem that many people posted in the comments (tells me tables that exist don't exist). But apart from that, since it is limited to 1MB, I'm worried that if that DB ends up being larger down the road, I'd have to completely re-work how it is handled.

Which brings me to this question: how can I load a DB from the assets folder in a better manner?

Rhyono
  • 2,420
  • 1
  • 25
  • 41

1 Answers1

1

If you are developing android application <3.0 android version,

So the best solutions are,

  1. Shrink your database file size and make it smaller then 1 MB.

  2. Or just describe table structure in database file and download larger data from web server (using web service).

  3. Cut your database file in separate chunks, Load files bigger than 1M from assets folder

But there are some quick fixing solutions are also available,

I seen one comment in SO for same kind of question which just change the SQLite db file extension and use it,

It something changing of extension of the file in assets folder from .sqlite to ".jpg". (Try this if its worked in your case, As I never try it)

Also look at this post about Dealing with Asset Compression in Android Apps you will get something helpful from that.

Community
  • 1
  • 1
user370305
  • 108,599
  • 23
  • 164
  • 151
  • That solves the main question (hence choosing your answer); do you happen to know what would cause it to not notice that a table exists even when it does? – Rhyono Mar 03 '12 at 07:21
  • It just about the referring different database files from /data/data//database/ directory, just check it in your directory there are two different database files are created and you are referring inbuilt created database file. – user370305 Mar 03 '12 at 07:23
  • Could you please help me to upload large video from android app? Any link or reference. Right now able to upload <2 MB video but issue "OutOfMemory" is being raised as soon as i try to upload >2 MB. And right now following approach of creating video chunks and uploading the same. Could you please suggest anything? Any links/reference/library? Thanks – Paresh Mayani Feb 07 '13 at 07:59
  • @PareshMayani - Did you look at [HttpURLConnection](http://developer.android.com/reference/java/net/HttpURLConnection.html) ? For [setChunkedStreamingMode](http://developer.android.com/reference/java/net/HttpURLConnection.html#setChunkedStreamingMode%28int%29). – user370305 Feb 07 '13 at 09:35
  • @PareshMayani - This will also help you, [FileEntity](http://developer.android.com/reference/org/apache/http/entity/FileEntity.html) and [SO Question](http://stackoverflow.com/questions/3038409/how-to-send-http-post-request-and-recieve-response/3038747#3038747). – user370305 Feb 07 '13 at 09:44