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 6190585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T02:36:54+00:00 2026-05-24T02:36:54+00:00

I created a widget that uses a service with wakelock to update and parse

  • 0

I created a widget that uses a service with wakelock to update and parse data from an xml and update the widget’s UI so that items would “rotate every few seconds (standard news feed widget).

The problem is that the UI stops updating after a few hours although the data keeps updating.

Here’s the code I am using to update the UI:

mUpdateTimeTask = null;
mUpdateTimeTask = new Runnable() 
{
    public void run() 
    {
        if(which_item+1 < Widget_titles.length)
            which_item++;
        else
            which_item = 0;

        if(Widget_which_item_ed != null)
        {
           Widget_which_item_ed.putInt("WIDGET_WHICH_ITEM", which_item);
           Widget_which_item_ed.commit();   
        }
        else
        {
           Widget_which_item = context.getSharedPreferences("WIDGET_WHICH_ITEM", Context.MODE_WORLD_WRITEABLE); 
           Widget_which_item_ed = Widget_which_item.edit();

           Widget_which_item_ed.putInt("WIDGET_WHICH_ITEM", which_item);
           Widget_which_item_ed.commit();   
        }


        updateViews.setTextViewText(R.id.WidgetText, Widget_titles[which_item]); 
        updateViews.setTextViewText(R.id.WidgetPostTime, rightNow.get(Calendar.MONTH)+"/"+rightNow.get(Calendar.DATE)+"/"+rightNow.get(Calendar.YEAR));
        manager = AppWidgetManager.getInstance(context);
        manager.updateAppWidget(WidgetId, updateViews); 

        mHandler.removeCallbacks(mUpdateTimeTask);
        mHandler.postDelayed(this, widget_interval * 1000);
    }
};

mHandler.postDelayed(mUpdateTimeTask, widget_interval * 1000);
Log.i(TAG, "sliding update handler was configed");

I am really stuck and could really use help.

Edit:

i managed to go around this problem by implementing the BroadCastReciever for the screen on/off intents as shown in a tutorial here: http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/
and therefore the amount of time that the widget needs to run is much smaller.

  • 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-24T02:36:56+00:00Added an answer on May 24, 2026 at 2:36 am

    Edit:

    i managed to go around this problem by implementing the BroadCastReciever for the screen on/off intents as shown in a tutorial here: http://thinkandroid.wordpress.com/2010/01/24/handling-screen-off-and-screen-on-intents/ and therefore the amount of time that the widget needs to run is much smaller.

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

Sidebar

Related Questions

I've created a Vista sidebar widget that uses jQuery to fetch XML and display
I have created a battery widget that uses a Service to listen for Battery
I created a widget that users of my site will embed on their web
The organization I work for has created a small flash widget that we're encouraging
I would like to create a widget so that my visitors can display it
I have created a few small flash widgets that stream .mp3 audio from an
I'm having trouble starting a Service to update an AppWidget that I'm creating as
My app uses a WebView widget to load ads from Google AdManager. AdManager gives
Hey all, I've created a widget that will essentially unlock a music track, providing
I created a widget that is a subclass of Composite and has a com.extjs.gxt.ui.client.widget.Viewport

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.