Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8218801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:55:35+00:00 2026-06-07T12:55:35+00:00

two years past, there comes fragment, intent service, cursor loader. Is the approach still

  • 0

two years past, there comes fragment, intent service, cursor loader. Is the approach still up to date, or is there any better or mature pattern to design an android rest client, especially compare to the option B (I don’t have the privilege to post image, instead the image could be found from this post).

I know the content provider part is essential. what about the service helper and service component? Up till now, the startService method is a nature of Context or its subclasses. which means the service helper would be an activity. So is it elegant to initiate an activity from a content provider, or should it be initiate from the activity on the top.

  • for those of you who digged into the google io 2011 iosched app source code, will you consider the static class SyncStatusUpdaterFragment in HomeActivity as the service helper, though it couldn’t start the SyncService, but it does listen to the call back from SyncService and trigger refresh of UI. So could it be seen as a variance of the Virgil Dobjanschi’s approach?

There comes service, intent service, asyncTask and thread. In my opinion, the intent service is suitable for sync of mega pack of data from remote server. That why they use it in the iosched. But the common scenario is that only a part of items will be synchronized with the remote server. So the intent service is too heavy. even the service approach. could we just use the asyncTask or thread in the content provider or some component of that to accomplish this kind of task. Or is there any convincing reason to use the service, and go through the service helper-service-processor path. I am talking about a serious application.

so what’s you opinion?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T12:55:37+00:00Added an answer on June 7, 2026 at 12:55 pm

    So is it elegant to initiate an activity from a content provider, or
    should it be initiate from the activity on the top.

    You’ll never ever initiate an activity from the content provider. Everything should start from your activity, whether that’s a AsyncTask, Service, or Content Provider request…

    AsyncTasks are generally a poor choice. They’re simply flawed when it comes to dealing with configuration changes (i.e. screen orientation change). Loaders are the solution to this, but the difficult part is wrapping that together with your network calls. One solution is to build the network calls from a custom loader (subclassing AsyncTaskLoader).

    However, in my case, I followed the 2010 Google IO presentation. Built a class, ServiceHelper, to manage requests to the server in a Service object (which launches threads to perform network queries). The ServiceHelper manages the ResultReceivers which can be created from the calling Activity. This allows the activity to listen to events from the Service request such as when the query starts and finishes (or when it errors out). These threads will call their network queries and then store the resulting data in a ContentProvider (for caching and to use across multiple Activities if necessary).

    At the same time, I have a CursorLoader on the Activity that listens to the endpoint which the network thread will write to. Obviously there’s a lot of middle ground to work out yourself.. such as your caching policy and the overhead for such an implementation. But that really depends on the app you’re building and the API you’re integrating with.

    So yes, I think that the 2010 presentation is still valid.. there were a lot of vague areas of his presentation and the continues today. You’ll have to still work out a design that works for your app

    Hopefully, my thoughts will help you get started..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After two years of Android development I'm still not 100% sure about what resources
I've been using ASP.NET (C#) for the past two years. I have learned so
I've been using Codeigniter for the past two years and really have become a
I've been using MVVM for the past two years and it has certainly evolved
I've been developing games and websites for the past two years, and really love
the following piece of C++ code compiled two years ago in a suse 10.1
In the following example I have two years worth of data denoted by data_2007
I've been working on an application for a little over two years and have
I've moved from SeleniumRC to WebDriver for nearly two years. But I have to
I have once again fleshed out Ruby, after two years of not touching it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.