Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Android 4 Application Development
This is the forum to discuss the Wrox book Professional Android 4 Application Development Reto Meier; ISBN: 978-1-1181-0227-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 29th, 2014, 10:39 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question 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:
https://dl.dropboxusercontent.com/u/...roid/Main.java
https://dl.dropboxusercontent.com/u/.../Database.java
https://dl.dropboxusercontent.com/u/...tProvider.java

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

Last edited by Codex; June 29th, 2014 at 10:44 AM..
  #2 (permalink)  
Old July 9th, 2014, 12:02 PM
Authorized User
Points: 89, Level: 1
Points: 89, Level: 1 Points: 89, Level: 1 Points: 89, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2013
Posts: 27
Thanks: 1
Thanked 0 Times in 0 Posts
Default Content Provider, LoaderManager

Hi,
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 :
Code:
    Thread t = new Thread(new Runnable() {
      public void run() {
    	  update(); 
      }
    });
    t.start();
  }
  
  Handler handler = new Handler();
  
  public void update() {
    handler.post(new Runnable() {
      public void run() {
    	  getSupportLoaderManager().restartLoader(0, null, this);
      }
    });
  }


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in Content Provider & SQLITE puneetverma05 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 0 January 15th, 2013 12:47 PM
Textual content in mixed content model flockofcode BOOK: Beginning XML, 4th Ed ISBN: 978-0-470-11487-2 2 May 11th, 2011 03:54 PM
Earthquake Content Provider Chapter 7 crustymonkey BOOK: Professional Android 2 Application Development 0 October 21st, 2010 07:31 PM
Problem: Chapter 7 "Creating and Using an Earthquake Content Provider" (Page 232) DrGaribaldi BOOK: Professional Android 2 Application Development 0 June 17th, 2010 04:07 AM
Does the content provider allow for MySql synchronization? Porjung BOOK: Professional Android 2 Application Development 2 April 7th, 2010 08:59 PM





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