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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:27:52+00:00 2026-06-12T05:27:52+00:00

I have a problem updating my AppWidget from within a Service. The problem seems

  • 0

I have a problem updating my AppWidget from within a Service. The problem seems totally illogical to me, so I make a TestService to hunt the mistake down.
Here is my testlayout I use:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >
    <TextView android:id="@+id/testText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Hello World"/>
</LinearLayout>

onStart(Intent, startid) is implemented as following:

@Override
public void onStart(Intent intent, int startId) {
    super.onStart(intent, startId);
    Log.d(TAG, "onStart Service with StartId: " + startId);
    mStartId = startId;

    int widgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
    if (intent != null && intent.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)){
        widgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,
                                      AppWidgetManager.INVALID_APPWIDGET_ID);
    }

    if (widgetId == AppWidgetManager.INVALID_APPWIDGET_ID){
        Log.d(TAG, "invalif AppWidgetId");
        stopSelf();
    }

    RemoteViews mRemoteViews = new RemoteViews(getPackageName(), R.layout.testlayout);
    mRemoteViews.setTextViewText(R.id.testText, "someText");
    AppWidgetManager.getInstance(this).updateAppWidget(widgetId, mRemoteViews);

    SystemClock.sleep(1000);
    mRemoteViews.setTextViewText(R.id.testText, "text after delay");
    AppWidgetManager.getInstance(this).updateAppWidget(widgetId, mRemoteViews);
}

In This implementation, the resulting Widget has always the Text: “someText”, but it should be “text after delay” in my point of View. If I remove that Line SystemClock.sleep(1000) I get the “text after Delay”. Why is this?
(Tested on A Samsung Galaxy Nexus (4.1.1)

  • 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-12T05:27:54+00:00Added an answer on June 12, 2026 at 5:27 am

    I have found, that it can be cosidered as a bug that occured on my phone (GalaxyNexus). A restart of the phone fixed it somehow. Like in the ‘good old’ Windows days, “have you tried to switch it on and off”

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

Sidebar

Related Questions

I have a problem with updating the value of property from code which is
I have problem in updating mysql table. While the problem seems somewhat strange I'm
hey , I have a problem with updating a record using a domain service,
Have a problem with updating an existing record of my DB. In my view
i have a problem with updating my textview. i am making a c2dm app.
I have a little problem in updating date. My first table is DONOR donor-nic----username-----status
I have problem with UIWebView delay when the load image from url. In my
I have a problem updating a value of a variable in a shell script
I have problem updating attributes in a python class, I give a small example.
I have a problem updating the layout of my listbox using MVVM with Prism

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.