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

  • Home
  • SEARCH
  • 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 7433233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:34:58+00:00 2026-05-29T09:34:58+00:00

I have a simple app that reads internet resource and displays the information in

  • 0

I have a simple app that reads internet resource and displays the information in a widget or in listview activity in form of imageviews and textviews.
In addition to downloading the data from internet it also shows it in widget in a ViewFlipper.

When I add the widget to the home screen, it fires onUpdate immediately, downloads the data from internet and updates the widget. This works just fine. Log shows onUpdate and dataDownloaded with about 3 sec apart.
On the next update (phone has gone to sleep mode), the update doesn’t happen and this is what my logs report.

  • onUpdate is called.
  • dataDownloading is called, but after 20 seconds after onUpdate has been initially called. I assume this is because the phone was in sleep and it takes time to initialize networks sockets etc.
  • After this, I get the ANR log entry and widget update doesn’t happen, process is practically dead, widget stays on screen and doesn’t respond to manual updates from within activity, which otherwise works when no ANR exception is thrown.

I’m looking for a possible solution to this. I was thinking about calling all the downloads in a different thread (from within the AppWidgetProvider, possibly using AsyncTask), store data in SQLite or local storage and doing the widget update (no downloads, just reading the data from SQLite and local storage) on the next onUpdate call. This would make the application/widget process more responsive and not fault into ANR.

Is this threading approach a bad practice? Is there an alternative? Should I use service instead? I’m inclined not to use a service, unless there’s a lot of pros for it.

Sorry for the wall of text 🙂

Edit: From the docs http://developer.android.com/guide/practices/design/responsiveness.html

Android will display the ANR dialog for a particular application when it detects one of the following conditions:

  • No response to an input event (e.g. key press, screen touch) within 5 seconds
  • A BroadcastReceiver hasn’t finished executing within 10 seconds
  • 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-05-29T09:35:00+00:00Added an answer on May 29, 2026 at 9:35 am

    Threading is the only way to safely do network access on Android. So, yes, you’ll need to use something like an ASyncTask or IntentService. Note that a plain Service won’t be much help, since that runs on the main thread.

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

Sidebar

Related Questions

Help me, Stackoverflow! I have a simple .NET 3.5 console app that reads some
I have one simple app that suppose to get information from user and send
I have a simple C# Console App that reads in an XML file specified
I have simple app that reads acceleremoter values (for x,y and z axis). But
I have a simple webapp using node.js that reads the database and displays this
This is a real newbie question. I have simple app that selects a picture
I have a simple app that will allow a user to tag a location.
Right so I have a simple app that consists of a calendar a Set
I'm now testing GKPeerPickerController. I have a simple app that just have a button
I have a simple catalogue app that lets users download product data from an

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.