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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:18:11+00:00 2026-05-24T17:18:11+00:00

I made I widget for reading news-items. If I put one widget at my

  • 0

I made I widget for reading news-items. If I put one widget at my homescreen, everything is fine. But if I put a seconde one at my homescreen and I remove it, the service of the widget stops. So if the widget gets in the update methode, an error occurs.

java.lang.RuntimeException: Unable to start service news.WidgetActivity$UpdateService@405231d8 with Intent { flg=0x10000000 cmp=news/.WidgetActivity$UpdateService bnds=[26,97][79,151] }: java.lang.NullPointerException

A nullpointer is at this line:

RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);

Here the code:

public static class UpdateService extends Service {
    @Override
    public void onStart(Intent intent, int startId) {

        RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);

        remoteViews.setViewVisibility(R.id.WidgetRefresh_btn, View.GONE);
        remoteViews.setViewVisibility(R.id.progressWidget, View.VISIBLE);

        appWidgetManager.updateAppWidget(appWidgetId, remoteViews);

        WidgetActivity.Widget.onUpdate(context, appWidgetManager, appWidgetIds);

    }

    @Override
    public IBinder onBind(Intent arg0) {
        return null;
    }
}   
  • 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-24T17:18:13+00:00Added an answer on May 24, 2026 at 5:18 pm

    Your context object is probably null. Since you are in a service, which extends Context, you may as well use this.getPackageName() or just getPackageName() instead.

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

Sidebar

Related Questions

When I try to put my weather widget on the homescreen I want to
I have an Android app I made and everything works but I want to
Made a custom obj called Item with some string fields and one float. .h
I made a new widget following the LatestTwitter example from Maarten Balliauw. My project
I made a blog widget in flex. I need manipulate cookie in my widget
I made an app which is just working fine. It displays the number of
I have made my own simple widget by deriving from QWidget, and am trying
I made a button widget in jQuery which displays an icon. Now when I
A while back I made a cocoa widget that was a button that when
made a menu out of the following code but the original href in the

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.