p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android 4 Application Development (http://p2p.wrox.com/forumdisplay.php?f=685)
-   -   Content Provider, LoaderManager (http://p2p.wrox.com/showthread.php?t=93177)

Codex June 29th, 2014 10:39 AM

Content Provider, LoaderManager
Hello, i have a counter application, and list of count items in my database. I was using SimpleCursorAdapter with ListActivity and and it was easy to populate items on Adapter. i was doing database operations using sql queries.

Now i switched to LoaderManager and ContentProvider. I read Chapter 8, my PROBLEM is i constructed my content provider, but when i update any data using ContentResolver(contentProvider) , it is tooo slow. I have about 5 items displayed on my screen, each has increase buttons (http://goo.gl/RmnTmO)

So if i click plus button, i update value with value+1. Those are links for my ContentProvider, Database, MainActivity:

HELP with this contentProvider and Asynch LoaderManager thing, they are sooo slow. and i dont want to use depreciated startManagingCursor(cursor);

Kees July 9th, 2014 12:02 PM

Content Provider, LoaderManager
I am not that familiar with this stuff but don't see an asynchronous loader here, as that restartLoader is called in a new thread.
At the end of onCreate in your main for instance :

    Thread t = new Thread(new Runnable() {
      public void run() {
  Handler handler = new Handler();
  public void update() {
    handler.post(new Runnable() {
      public void run() {
              getSupportLoaderManager().restartLoader(0, null, this);

All times are GMT -4. The time now is 01:24 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.