android - Loading a BIG SQLiteDatabase in a ListActivity -
i'm working on android project need finish fast.
one of app's features loading sqlite database content , listing in listview inside listactivity.
the database contains few tables, among 2 large.
each item in database has many columns, out of need display @ least 2 (name, price), although preferably 3.
this might seem pretty easy task, need in part of app read database , list it. did without problems, testing app versus small sample database.
in first version, used cursor query, arrayadapter list's adapter, , after query loop cursor start end, , each position add cursor's content adapter.
the onitemclicklistener queries database again versus other parameters (basically open categories) clears adapter, loops cursor , adds content adapter on again.
the app worked charm, when used real-life, big database (>300mb) got app taking long display contents, , blocking.
so did research , started using simplecursoradapter automatically links contents of cursor listview using usual parameters (string[] from, int[] etc., used android.r.layout.simple_list_item_2 , android.r.id.text1 , text2).
problem is, doesn't change time load.
i've came across suggested solutions on different web sites , tutorials, of them using, in 1 way or another, asynctask class. tried implementing manually myself it's hard keep track of multiple threads , failed.
tutorials keep telling how content providers, found nothing clear bout specific situation: big sqlite database -> read listview.
now head filled in notions loadermanager, loaderadapter etc, mixed , confused in head.
can please provide me complete, nice, clean solution "simple" task?
again: want read big sqlitedatabase , display in listview. want app not block.
i need class has member function takes parameter query , listactivity's context , takes care of displaying result of query in view.
please don't provide me abstract answers. i'm running out of time , i'm confused right , need clean complete solution.
you're hope.
if query such large database take tym, need find smart way,
like limit database query first 10 or 30 items , maintain,once last item reached query rest 30 items , bind them
refer tutorial, teach how add data dynamically in list view
http://p-xr.com/android-tutorial-dynamicaly-load-more-items-to-the-listview-never-ending-list/
the above list has expired chk this
Comments
Post a Comment