Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 29th, 2014, 11: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 11:44 AM.
Reply With Quote
  #2 (permalink)  
Old July 9th, 2014, 01: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);
      }
    });
  }
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04:54 PM
Earthquake Content Provider Chapter 7 crustymonkey BOOK: Professional Android 2 Application Development 0 October 21st, 2010 08: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 05:07 AM
Does the content provider allow for MySql synchronization? Porjung BOOK: Professional Android 2 Application Development 2 April 7th, 2010 09:59 PM



All times are GMT -4. The time now is 12:36 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.