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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:42:52+00:00 2026-06-05T21:42:52+00:00

I have an activity with a spinner which loads a simpleCursorAdaptor. I call another

  • 0

I have an activity with a spinner which loads a simpleCursorAdaptor. I call another class to return the cursor which is used by the simpleCursorAdaptor. I don’t keep a class level variable of the cursor or adaptor.

When this activity closes down I want to close the cursor. Should I:

a) in the activitie’s onDestroy() event, get the cursor from the spinner via the adaptor and close it there or

b) In the data handler class which generates the cursor in the first place

  • 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-05T21:42:54+00:00Added an answer on June 5, 2026 at 9:42 pm

    If you create the cursor using a loaderManager or a supportedLoaderManager you don’t need to worry about closing the cursor. It is also recommended to open a cursor using a loader to do it off the UI thread.

    However for some reason if you have to query for the cursor using the contentresolver on the UI thread, it is better to close the cursor in the onPause and requery the cursor in the onResume, worst case scenario close it in the onDestroy, there could be an instance that the activity maybe garbage collected before onDestory is called.

    However as mentioned above please try to create the cursor using a CursorLoader with the Loadermanager and LoaderCallbacks

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

Sidebar

Related Questions

I have an android activity in which I'm using tabs. public class UnitActivity extends
I have an activity which shows a Spinner (selection of category of items), a
I have 2 activities. Activity 1 is the 'Homepage' which consists of one spinner.
I am having trouble with my activity management. So I have activity A which
I have set a value in spinner , from activity-1. now i am traversing
I have a Main-Activity which displays several spinners. With a Toggle-Button in the Main-Activity
I have generic async task class which fetches response from server . And i
I have a simple spinner which has several number options. I want to just
Hi I have created an activity which pulls data from json format text and
I have created an application having tab activity which in turn has 5 different

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.