Filling a large database causes crash

by NFSpeedypur » Tue, 10 Mar 2009 11:00:25 GMT


Sponsored Links
 I am trying to on first start up fill up a sql database with the
default values.  This database is around 9000 entries and it is
causing the app to go over the 16MB heap.  I am trying to find a way
to do this so that it will not cause this over flow.

At the moment I am running the 9000 inserts, 1 after another in a
thread.  Are there any other suggestions?



--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by Mark Murphy » Tue, 10 Mar 2009 21:19:35 GMT


 


Use transactions. The heap problem is probably due to SQLite holding
everything in transaction buffers. You might, say, do a transaction for
every 100 entries or so.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Filling a large database causes crash

by NFSpeedypur » Thu, 12 Mar 2009 00:20:09 GMT


 I changed this to loading the database in from an asset and it works
fine.  But the issue is now the loading time.  On the emulator it
takes over 5 seconds for the list to be populated.  And when doing a a
filter (getListView().setTextFilterEnabled(true);) it takes almost 10
seconds to filter the list.  Is it unreasonable to think that about
9000 entries should be sorted faster?

Mark,

Does your book talk about handling this type of stuff?  I see that
version 2.0 is not in print so I plan to pick it up.

David





--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by Mark Murphy » Thu, 12 Mar 2009 00:37:40 GMT


 


That feels wrong, but I haven't tried a 9,000-row table.


Did you add an index on the to-be-filtered columns?


There's some coverage of this in the _Advanced Android_ book (not yet in
print, beta available to subscribers), with more to come as that book
gets expanded over the course of the next 12-18 months.


Version 2.0 is available in print. If you're looking at the Amazon page,
they *still* have not updated the cover (grrrrrrrrr) -- I'll be trying
to do that again later this week.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!

--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by NFSpeedypur » Thu, 12 Mar 2009 01:08:42 GMT


 No I did not add any index to the to be filtered columns, I am using a
basic array so I did not know there could be a index?

setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, Titles));

Maybe it will be worth grabbing the subscription on Commonwares
instead of the book.  If I download the pdfs, am I able to print pages
for personal use or is it only for computer viewing?

David





--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by Mark Murphy » Thu, 12 Mar 2009 01:13:09 GMT


 


If the data is in a database, use a CursorAdapter or
SimpleCursorAdapter, rather than loading them all into an ArrayAdapter.
That should be significantly faster.


Printing is perfectly fine for personal use.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by NFSpeedypur » Thu, 12 Mar 2009 01:19:51 GMT


 I believe I understand more of what you are saying about adding the
index.  Do you mean to the actual column in the database?  Does
filtering the text requery the database each time?

David







--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by NFSpeedypur » Thu, 12 Mar 2009 01:21:53 GMT


 I see yes I had tried the cursor in the past and it does work faster,
but I could not get the Filter to work.  Do I need to write my own
search portion if I use the cursor method?

Thank you for your help.  You personally have been a lifesaver to me,
in the android field.

David






--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by Mark Murphy » Thu, 12 Mar 2009 01:22:02 GMT


 


That I don't know -- I haven't tried filtering. My guess is yes, but
queries, particularly on indexed columns, should be pretty snappy.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by Mark Murphy » Thu, 12 Mar 2009 01:24:25 GMT


 


Unfortunately, I don't know -- I haven't tried filters with cursors as
yet. There's just *so* many nooks and crannies to play around in! I'll
add that to my to-do list for a future edition of _Advanced Android_.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
_The Busy Coder's Guide to Android Development_ Version 2.0 Published!

--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by NFSpeedypur » Thu, 12 Mar 2009 01:25:47 GMT


 Alright well I will work on that and maybe send you an email if I can
find additional information about it.  I just purchased a commonswares
subscription and I look forward to reading your books.

David





--~--~---------~--~----~------------~-------~--~----~



Filling a large database causes crash

by Will » Sat, 14 Mar 2009 08:41:48 GMT


 You will need to write your own filter when filtering.  I have only
done it with a Cursor (SimpleCursorAdapter sepcifically).  Searching
the Developer group for AutoCompleteTextView should send you in the
right direction.






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Leaving SlideME and Launching MiKandi

Guys,

Just to let you know, this week will be my last week at SlideME. It's been a
wild ride over the last two years and much of what I set out to do I was
fortunate enough to be able to do with SlideME. It is now the largest
alternative Android marketplace and has a healthy user and developer
community around it. SAM, our client, has been deployed on a large number of
handsets around the world.

I tried to start something similar with J2ME back in 2003-2004 with
JVending; but it was too early and the market was carrier controlled. All of
that has changed with the iPhone and Android, leaving an opening for
communities like SlideME and AndAppStore to sprout up and grow.

SlideME has a great, hard-working team behind it and I have confidence that
it will continue to grow and maintain itself with a community focus. It's a
little bumpy as new members of the team get up to speed, so bear with them.

As for myself, I've formed a fantastic team here in the Seattle area and
partnered with industry experts to build MiKandi - the largest Mobile {*filter*}
App Store:  http://www.***.com/ . It was an area that other members of SlideME
understandably didn't want to enter, but I found building an app store as
highly disruptive to the {*filter*} industry; so I couldn't resist. I have an
itch to do things that haven't been done before.

MiKandi is currently on the Android platform and all I can say is the amount
of interest from companies and individuals has been amazing. We just
launched today, so check it out. For developers who are frustrated with lack
of sales, you definitely want to check out this industry. In truth, there is
no industry, just a lot of users who are dying to buy mobile {*filter*} apps..
It's up to you to jump in and build it and make serious money from it. If
interested, I'll send you an invite code. Also check out more info:

 http://www.***.com/ 

I'm also starting another company with Henrique (also a former co-founder of
SlideME). The company is called StackWire and will provide searchable
catalog as a service. Basically indexing of data in the cloud. It will allow
mobile, media application developers to build out their catalogs, optimized
for mobile devices. We are seeing this as an area that is not currently
being met. if you are interested in doing a beta with us, just ping me.

-- 
Shane Isbell (Co-founder of MiKandi - The World's First Mobile {*filter*}
AppStore)
 http://www.***.com/ 
 http://www.***.com/ 

--

2. usb to audio

Dear all,

Ada gak sih converter dr output usb magic ke jack audio?

-- 
Arianto C Nugroho

--~--~---------~--~----~------------~-------~--~----~
=========================
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group:

Click  

3. AudioRecord producing no-sound data. Why??

4. gnt case dream full housing...

5. ROM Turunan Cyanogen (WG-Build 8 CM 4.2.7.1, 10mb RAM+, New A2SD, ZipAlign, GApps, FAST)

6. Position/Size of AlertDialog with no Title

7. How to secure a paid app