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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:57:13+00:00 2026-06-02T00:57:13+00:00

currently I am using ListActivity. I use a cursor to get the data from

  • 0

currently I am using ListActivity. I use a cursor to get the data from SQL, and built the ListView according to the SQL query result. For every objects in my ListView, if I press that object (onListItemClick), it will change the value in the SQL that the cursor will read, and open a new intent.(Pressing on different object will change different value in the SQL table). To keep my ListView most updated, I use

//adapter is the SimpleCursorAdapter I use
protected void onListItemClick(ListView l, View view, int position, long id) {
    super.onListItemClick(l, view, position, id);
    //change the data in sql
    ...
    //change the data end
    adapter.changeCursor(dbAdapter.getResult(id));
    adapter.notifyDataSetChanged();
    //create intent here
    //startActivity(intent)
}

The problem is, if I keep pressing the same object, leave the intent it create, it works fine. But once I press a different object after I leave the previous intent, my ListView becomes empty. For example, if I press object a, I enter intent a, and then I leave intent a, back to List View (ListView is fine now), then I press on object b, I enter the intent b. When I leave intent b, the ListView becomes empty. Does anyone has any idea about this problem? Thank you.

  • 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-02T00:57:16+00:00Added an answer on June 2, 2026 at 12:57 am

    It sounds like some of your data is being destroyed. I think if you move your list creation code to onResume, your problem will solve itself as the list will be re-generated every time you come back, wheras in onCreate it is only done when the activity is first created.

    A picture is worth a thousand words:
    Activity Lifecycle

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

Sidebar

Related Questions

iam currently using NSURLConnection class to hit my server and get some data from
I am currently using PIL. from PIL import Image try: im = Image.open(filename) #
Im currently using the Barcode Scanner from the open source library Zxing in my
Im currently using PHP to fetch results from a mysql db. Im also displaying
I'm using a SimpleAdapter to populate a ListActivity. From the Google I/O video 'the
Currently using cocos2d. I have a plist data name myplist.plist. Inside the plist are
I was wondering if it's possible to get the following output when using ListActivity
I have a ListActivity that presents a list of names from a database using
I am using a ListActivity which fills from a database. Depending on a the
am currently using google feed api to get feed links dynamically. am trying to

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.