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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:46:17+00:00 2026-06-04T22:46:17+00:00

I have an application in the market with a bug which I can not

  • 0

I have an application in the market with a bug which I can not seem to solve. Today I have tracked it down to the following method.

public void updateDealList(ArrayList<Deal> deals) {
    // first call or showing bookmakrs (also gets called other times when adapter is null)
    if (dealListAdapter == null || showingBookmarks || !dealListAdapter.moreDealsToDownload()) { 
        dealListAdapter = new EndlessDealListAdapter(getActivity(),
                R.layout.deal_list_item, deals);
        setListAdapter(dealListAdapter);
        listView = getListView();
        if (getActivity().findViewById(R.id.right_fragment_container)!=null){ // if tablet
            listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
            listView.setVerticalScrollbarPosition(View.SCROLLBAR_POSITION_LEFT);
        }
        showingBookmarks=false;
        Log.d("UPDATE_DEAL_LIST", "Notified list  created new" + dealListAdapter.getCount());
        return; //PROBLEM OCCURS WHEN APP COMES IN HERE AFTER RESUMING
    }
    dealListAdapter.getDealListAdapter().clear();
    for (Deal d: deals){
        dealListAdapter.getDealListAdapter().add(d);
        Log.d("UPDATE_DEAL_LIST", "added " + d.title);
    }
    dealListAdapter.notifyDataSetChanged();
    Log.d("UPDATE_DEAL_LIST", "Notified list " + dealListAdapter.getCount());
}

This method is passed an arraylist of deal objects which are pulled down from the internet. When the application is first opened data is pulled from the internet and the above method is called which creates a new adapter which is set for the ListFragment. This method is also called when the user requests more deals.

The problem I am having is that the list sometimes thinks its empty dispite the adapter containing deals. This seems to occur when a use resume the application when their device is low on memory (I presume part of the application has been removed from ram). This method is called and the dealListAdapter is null so a new one is created and deals are added. Despite this happening the list remains empty and the user has to force close the app to get it working again.

The line below shows tat when the method is called it enters the if and 21 deals are added to the adapter. Unfortunately the list is empty to the user.

05-23 01:52:32.879: D/UPDATE_DEAL_LIST(3478): Notified list  created new21
  • 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-04T22:46:20+00:00Added an answer on June 4, 2026 at 10:46 pm

    One idea (pretty long shot 🙂

    If the app itself wasn’t killed, just the activity, the system tries to recreate the activity’s last state, calling the onRestoreInstanceState().
    This method will not be called if the app was killed – so this is one of the big differences between the two.

    The ListActivity overrides the onRestoreInstanceState(). It ensures, that the List exists, before it goes on. If the list does not exist, it inflates it from the default place.

    If you’re setting the contentView in the onResume() try to move it to onCreate(), that may solve the problem.

    I can help more, if I see the activty’s code.

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

Sidebar

Related Questions

My question is the following: can I have one application on the market, but
I have a problem while publishing on the Market. My application does not use
I have stock market application which will be frequently used by millions of members
I have an Android application in the market which connects and send POST and
I've an application in the market and many users have reported that the app
I have developed and published an Android application on the Android market. The phone
I have application which uses Sherlock ActionBar package. The application uses platform-specific behavior for
I have application which needs to use a dll (also written by me) which
I have application which is for paranoic users who used to store their sensitive
i have uploaded an application in android market that was displayed in my android

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.