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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:44:09+00:00 2026-06-15T03:44:09+00:00

After removing my last appWidget instance from home screen, onDisabled , onEnabled not working.

  • 0

After removing my last appWidget instance from home screen, onDisabled, onEnabled not working.

I register my widget as a broadcast receiver, there is no instance on home screen but broadcast receives and also I see my logs that written in my appWidget core class!

After uninstalling my application and installing it again, the problem solved and onDisabled, onEnabled worked correctly after adding(removing) first(last) instance.

I gathered appWidgetIds manually and holding it in a file to provide some better way to access all my widgets ids, but the hidden appWidget not removed from my collected widget ids and also exist in home screen!

The Question:

Is the problem a bug on Android Version 2.3.4(Testing Device)? and in this case what is the solution?

Important part of codes:

@Override
public void onEnabled(Context context) {
    G.logger.out("Enabled");
    super.onEnabled(context);
}


@Override
public void onDisabled(Context context) {
    super.onDisabled(context);
    G.logger.out("Disabled");
    File file = new File(G.infoDir + "/" + getClass().getSimpleName() + ".dat");
    if (file.exists()) {
        file.delete();
    }
}

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
    WidgetProperty property = G.widgetPropertyMap.get(getClass().getSimpleName());
    property.appWidgetIds = appWidgetIds;

    addWidgetIds(appWidgetIds, getClass().getSimpleName()); // add widget ids to a file ( duplicates will skip )
    updateAll(getClass(), context);
}

@Override
public void onDeleted(Context context, int[] appWidgetIds) {
    G.logger.out("Deleted");
    removeWidgetIds(appWidgetIds, getClass().getSimpleName()); // remove widget ids from file
}
  • 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-15T03:44:11+00:00Added an answer on June 15, 2026 at 3:44 am

    Very bad design on AppWidgets in android.

    To reproduce the bug:

    • Select Widget ( to drop on home screen )
    • Select Back ( hardware key ) to cancel drop widget
    • Now you have hidden widget.

    I was included setResult(RESULT_CANCELED); to prevent this issue, but will not handle by android framework!!!

    So I used this code as an stupid solution:

    @Override
    protected void onDestroy() {
        if ( !submitted) {
            AppWidgetHost host = new AppWidgetHost(this, 1);
            host.deleteAppWidgetId(mAppWidgetId);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After removing hash from URL using window.location.hash='' page getting reloaded in firefox. EDIT Example:
In most Node.js libraries people take special care removing trailing commas after the last
So, I could accomplish this by using 'topLevelSomething and removing the last token after
I'm removing the rows from a table and then reinserting them after user has
Possible Duplicate: Removing last comma in PHP? Remove the last Comma from a string
Update I have just tried Pinning my site to the Taskbar again (after removing
I need some help removing spaces after hiding certain HTML elements. In context, I
After removing the minimum element in a binary heap, i.e. after removing the root,
This is an extract from Advanced Liniux Programming: Semaphores continue to exist even after
I was attempting to use :last-child with IE8, but after reading several threads about

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.