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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:44:04+00:00 2026-06-08T18:44:04+00:00

I am developing an app for Android I have different categories: String[] cat =

  • 0

I am developing an app for Android

I have different categories:

String[] cat = { "Category",  "Books", "Clothing", "Shoes", "Hobbies", 
                 "General", "Electronics", "Transportation", "Medicine",
                 "Sports", "Education", "Outdoor"};

The UI asks the user to select a category, Name, and some description which is then written to a db. When the user presses the List button, every category that is filled is shown and the items under that category is also show using an ExpandableListActivity.

List<List<String>> children = new ArrayList<List<String>>();

/**********************
  I have a list for each category!!! But I don't like this solution. :(
**********************/
List<String> books = new ArrayList<String>();
List<String> clothing = new ArrayList<String>();
    ...
    ...

public void fillData() {

// Get all of the notes from the database and create the item list
Cursor c = mDbHelper.fetchAllItems();

startManagingCursor(c);

// for all rows
for(int i=0; i<c.getCount(); i++)
{
    // next row
    c.moveToNext();

    // pick a category
    String t = c.getString(c.getColumnIndex("category"));

    switch (getCat(t))
    {
    case Books:
        books.add(c.getString(c.getColumnIndex("name")));
        break;
    case Clothing:
            // do stuff for Clothing
        break;

     /**
       And there are other cases for the rest of the categories but i am not listing
       them here, since it is the same process
     */
        default:
        break;
    }   // end switch
} // end for loop

    //for each category that has been filled up
    children.add(category);
} // end function

My Question:

is it possible to not have to create a list for each category? I tried with one list but the results do not look very good. All categories show the same items and not the individual items, which makes sense.

  • 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-08T18:44:08+00:00Added an answer on June 8, 2026 at 6:44 pm

    i just created a list of lists, and worked 🙂

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

Sidebar

Related Questions

I'm developing an app in android and I have to support all different screen
I am developing an Android app and have already found out that different Android
I started developing an android app that have to interact with MMS attachements, in
I am developing an android app in which I have included a library project,
I'm developing an Android app in Eclipse Helios and I appear to have accidentally
I am developing an android app. I have tested the app in mobile and
i am developing an android app using phonegap. I have trouble displaying special characters
I'm developing an android app, and I need to have a json response of
I have a 2.3.3 android app that I am developing that I would like
I am developing an Android (API level 7) app in Eclipse 3.7.2. I have

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.