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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:38:57+00:00 2026-05-27T10:38:57+00:00

I have one table in sqlite database which contains five different columns as shown

  • 0

I have one table in sqlite database which contains five different columns as shown below.

CATEGORY    NOTE     DATE         PRICE       MODE
travel      delhi    10/5/2011    800          cash
food        daily    9/5/2011     500          cash
travel      goa       12/5/2011    1000         cash

The values in database are added by runtime from user. After all I retrieve it through content provider and store into an ArrayList and shown onto listview. But right now I want show it as per category means I want shown a category below that all its tasks then next category & its tasks like this. Item is class which contains all columnames as data members & its setter’s and getter’s. Any help will be appreciated.

  • 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-05-27T10:38:58+00:00Added an answer on May 27, 2026 at 10:38 am

    Use Guava’s MultiMaps.index method. It will create a MultiMap, i.e. a Map with categories as keys, and the list of items as values.

    If you can’t use Guava, then do what this method does:

    • create a Map<String, List<Item>> where the key is the category
    • iterate through the list of items, and place each item in the map

    Here’s an example:

    Map<String, List<Item>> itemsByCategory = new LinkedHashMap<String, List<Item>>();
    for (Item item : theListOfItems) {
        String category = item.getCategory();
        List<Item> itemsOfCategory = itemsByCategory.get(category);
        if (itemsOfCategory == null) {
            itemsOfCategory = new ArrayList<Item>();
            itemsByCategory.put(category, itemsOfCategory);
        }
        itemsOfCategory.add(item);
    }
    
    for (Map.Entry<String, List<Item>> entry : itemsByCategory.entrySet()) {
        System.out.println("Category " + entry.getKey() + ":");
        for (Item item : entry.getValue()) {
            System.out.println("    Item : " + item);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one problem with Android SQLite database. I have one table which contains
I have a .sqlite db which contains only one table. That table contains three
I have one sqlite database which has one table in which I store the
In my app I have SQLite database that has one table with date rows
I have a database name "CUED" (sqlite Android)it have a table HELLO which contain
I have one table, t1, which has fileds called userid, week and year fields.
Here is my situation: I have one table that contains a list of drugs
My setup: I have a sqlite database from which I populate a NSMutableArray of
I have a SQLite database, which needs to be updated. Using the update statement
all i am working on one application in which i have to used database.

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.