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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:14:48+00:00 2026-05-23T10:14:48+00:00

In my widget class that extends extends AppWidgetProvider I have some static final ArrayLists

  • 0

In my widget class that extends extends AppWidgetProvider I have some static final ArrayLists that contain data. I have some buttons in my Widget that when pressed result in onReceive being called within the class. I have noticed sometimes the ArrayLists will have lost their values (be empty) when the onReceive is run but most of the time they have data as expected.

Is the ArrayList safe to use in this context? Is there any widget lifecycle events that would cause the list to be re instantiated. I am finding it very hard to find any documentation on Widget Lifecycle events.

  • 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-23T10:14:49+00:00Added an answer on May 23, 2026 at 10:14 am

    Is the ArrayList safe to use in this context?

    No. If nothing else of your application is running, your process may be terminated between onUpdate() calls.

    Is there any widget lifecycle events that would cause the list to be re instantiated.

    Your process was terminated.

    I am finding it very hard to find any documentation on Widget Lifecycle events.

    That’s because there is no lifecycle in the manner that you are thinking.

    An AppWidgetProvider is a manifest-registered BroadcastReceiver. A manifest-registered BroadcastReceiver lives only so long as does its onReceive() call. Nothing that lives outside of that scope, such as static data members, will be reliable.

    Please store your information in files or databases.

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

Sidebar

Related Questions

My problem is that in my Widget class i've the following declaration: MouseEvent* X;
I am using a fictional example for this. Say, I have a Widget class
I have a UI widget that needs to be put in an IFRAME both
We have a UI widget on our main UI that uses JavaScript to respond
My sample widget: class myWidget extends sfWidgetFormTextarea{ public function getJavascripts(){ return array('my_widget.js'); } public
I'm making a new class called 'Cell' which extends the GWT Widget class. The
I have a JavaScript widget which provides standard extension points. One of them is
Slashdot has a little widget that allows you to tweak your comment threshold to
What is the easiest cross platform widget toolkit? I'm looking for one that minimally
I am building a custom win32 control/widget and would like to change the cursor

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.