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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:58:26+00:00 2026-06-03T21:58:26+00:00

I doing a Android project wich has two Activities. Both of these Activities are

  • 0

I doing a Android project wich has two Activities. Both of these Activities are Listactivities.

The first Activity is the entry point of the app, in that list it’s possible to create new names that are added to the list. I want to store these names in either a shared preference or to a file. But I don’t know how to do it. I’ve tried both but with no success.
When a item in this list is pressed an instance of the other activity should be shown and only the list items that belong to this choice should be visible.

To make it easier to understand you can think of it as a contacts app.

The data from both the first and the other list must be saved in some way.
How do I do that? Should I use shared preferences or internal storage?

And how can I do to make the second listview display the right data?

Thanks! /Tim

  • 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-03T21:58:28+00:00Added an answer on June 3, 2026 at 9:58 pm

    I used an SQLite database to do this.

    So in the first activity, I query the SQLite db and get a cursor object back, which I can plug into a cursorAdapter which then is used as the adapter for the list activity.

    In the cursorAdapter, for each item on the list, I set an onClickListener, which when clicked, launches the new activity and adds the list item to the new activity’s Bundle

    Finally, I get the list item from the Bundle in the new activity and use it to query the SQLite db again, and use that to produce the second list just like I did with the first

    http://developer.android.com/reference/android/widget/CursorAdapter.html

    Shared preferences is just for small stuff that uses little data and is only needed occasionally, such as preferences / settings

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

Sidebar

Related Questions

I am working on my first android project. i am doing a maos based
I am a android beginner. I am doing a android project which has a
I'm doing project on android chat application with both friends and anonymous. we finished
I'm doing a Get and Post method for an android project and I need
I am doing NDK profiling for my project using android-ndk-profiler-3.1. I have made changes
we are doing an android chat application in 2.3.3 as a project in final
I've been doing some research for a mathematical Android related project I'd like to
i am doing a project in android. i am a begineer in android also.
I am doing a project using TranslateAnimation in Android. In that I am translating
When developing for Android, is there any point to having a test project as

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.