This begs to a different kind of question: do you really need to store
this data in an sqlite3 database?

There are other alternatives, it all depends on your data and how you
want to use it so you might want to help us here.

Example: you mention "words", just not any string, so your data might
be a dictionary.
Then in this case you could simply use a binary file, in your own
format, packaged in your project/res/raw directory, which you can
retrieve with 
http://d.android.com/reference/android/content/res/Resources.html#openRawResource(int)
-- the file is added uncompressed to your APK but the APK itself is a
zip file, which is why you get an input stream. That also means if you
need direct random access you'll probably want to write it somewhere,
such as on the sdcard.
Make sure to write an index for fast lookup, for example the offset of
words starting by A, by B, etc. You will probably need to experiment a
bit to get a tradeof between simplicity of the index and lookup time,
e.g. a tree will have faster lookup times but is more tricky to get
right, etc.

R/

On Sun, May 31, 2009 at 6:11 AM, kaloer <mkal...@gmail.com> wrote:
>
> Okay, I'll look at it..
> Thank you very much for your help
>
>
> On 31 Maj, 14:59, Mark Murphy <mmur...@commonsware.com> wrote:
>> kaloer wrote:
>> > Well, of course I shouldn't. This only adds one line when it's called.
>> > Should I call it before the while-loop begins?
>>
>> You're right -- I skimmed it too quickly.
>>
>> It's actually a bit more complicated than that. The flow is:
>>
>> begin-transaction
>> insert 100 rows worth of stuff
>> set-transaction-successful
>>
>> and do that whole block 1000 times for 100,000 words.
>>
>> So you're probably going to wind up with something like:
>>
>> while ((line=input.readLine())!=null) {
>>     DB.beginTransaction();
>>     DB.execSQL(...);
>>
>>     for (int i=0;i<99 && (line=input.readLine())!=null; i++) {
>>         DB.execSQL(...);
>>     }
>>
>>     DB.setTransactionSuccessful();
>>
>> }
>>
>> plus an appropriate try/catch in there.
>>
>> However, bear in mind that this will still take a very long time, so
>> unless you're trying this for educational purposes, I'd move along to
>> one of the other options.
>>
>> --
>> Mark Murphy (a Commons 
>> Guy)http://commonsware.com|http://twitter.com/commonsguy
>>
>> _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
> >
>

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

Reply via email to