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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T21:24:21+00:00 2026-06-08T21:24:21+00:00

Basically I am creating an android music player. I have managed to store a

  • 0

Basically I am creating an android music player. I have managed to store a STRING into the “comment” section of each song in my library.

The String is of form eg. “guitar, drums, spanish, sad”

Now my concerns is to come up with a data structure to move around this mp3 file (its path) along with this STRING, in my code. What makes it more challenging is that:

the String as u saw above is made up of commas “,” So every time a user wants to create a playlist, they will just give me a list of words (TAGS) and I have to look into every song to find if it has the TAG they are looking for or not. I do so by splitting the String stored in the COMMENT section of the song into sub-strings(TAGS) and match it when the users input.

I am looking for suggestion for a good data structure.

Should I split the COMMENT Section before hand and keep it in some sort of collection? or do it as I am looping through every song ? split it to check it against the inputs?

I thought of using ArrayList >
but maybe there is a better way…

  • 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-08T21:24:22+00:00Added an answer on June 8, 2026 at 9:24 pm

    A reverse index will be more suitable if the list of songs is long. That is instead of looping through each song and checking if contains the tag you can find the tag directly and extract list of songs associated with it. Jumping to a tag directly can be done by using a Map and within an entry the value could be a List of Song(s).

    Map<String, List<Song>> tagIndex
    

    I am assuming Song is a class that abstracts a song.

    If its not possible to persist the index it can be built at startup in background.

    EDIT-1: (reply to first comment)

    I think all Android devices have SQLite available. If this is indeed the case an easy to integrate then there are couple of ways you can store and access the tags.

    1. Store tags in database and comments.
    2. Store tags in database only.

    In the first approach tags will survive application re-installs. But then comments are accessible for other applications too which may use it in other ways or edit/overwrite your values. In this approach you’ll have to build the index at application install and keep the comments and database in sync on the go once the initial index is built.

    Second approach is partly similar to first where tags stored in database and maintained on the go. But there is no initial build and tags may get erased if application is un-installed. This may or may not be acceptable but this approach is simpler than the first.

    If SQLite is used you’ll not need to maintain tags in memory at all. Everything can be maintained in database.

    Table: tag_index

    Columns: (tag_name, song_name, song_path)

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

Sidebar

Related Questions

Basically I have a tabbed Panel I'm creating. When the user click on a
I am creating an application that basically places a drawable into an imageView onClick.
So i have been creating this framework thing that basically puts together source code
I am creating an android app that is basically a listing of information on
I am creating an android app that basically records an applies an Effect on
I'm basically creating a trivia type of game. Where you have a question and
I have a problem with a custom LinearLayout I'm creating for an application. Basically,
I am creating a fairly simple android application which is basically a timer, I
Basically I am creating a database driven website in Web Developer 2008. The database
So basically I'm creating wordpress themes for Themeforest, and I would like to get

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.