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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:43:26+00:00 2026-06-05T17:43:26+00:00

When the user clicks on a button, a new ListFragment is displayed. This fragment

  • 0

When the user clicks on a button, a new ListFragment is displayed. This fragment will contain the list of the albums with their associated Artist’s name.

I’ve created my own class AlbumItem (String name, String artist) with name being the Album’s title and artist the corresponding artist name :

public class AlbumItem {

    private String AlbumName;
    private String AlbumArtist;

    public AlbumItem(){
    }

    public AlbumItem(String name, String artist){
        this.AlbumName = name;
        this.AlbumArtist = artist;
    }

    public String getAlbumName() {
        return AlbumName;
        }

    public void setAlbumName(String AlbumName) {
        this.AlbumName = AlbumName;
        }

    public String getAlbumArtist() {
        return AlbumArtist;
        }

    public void setAlbumArtist(String AlbumArtist) {
        this.AlbumArtist = AlbumArtist;
        }
}

Then I wrote my custom adapter which associates the Album’s name and Artist’s name with the correct TextView in my ListView’s row.

So then I can declare an ArrayList of AlbumItem and fill it like this :

ArrayList<AlbumItem> arrayList;
arrayList.add(new AlbumItem ("Album's title", "Artist");

Now I have few questions :

1) Am I going the appropriate way ? I’ve always learnt to fill listviews like that and I’m very comfortable using this technique (Custom Item class + ArrayList + CustomAdapter), but I’m doing a Music player and I’d like to query the list of Albums and update the listview asynchronously so that the UI is not blocked. I don’t know if it is possible to do it by loading data in a ArrayList the way I do it.

2) How to fill up this ArrayList asynchronously ? With LoaderManager/CursorLoader or Asyntask or something else ? (I’m targeting Android 4.0)

Thanks for your advice.

  • 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-05T17:43:29+00:00Added an answer on June 5, 2026 at 5:43 pm

    CursorLoader is a convenient way of loading your list, especially if you get the data from a database or another local data source. If your data comes from the network, it may be easier to get the data with an asynctask and load it in the list adapter. If you are familiar with one of these, use that.

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

Sidebar

Related Questions

How can I force validation when user clicks button? One would think this should
I used JavaScript to open a new window(child) when user clicks on button from
I'm working with the Passive View pattern. The user clicks a new account button.
In an ASP.Net application, the user clicks a button on the webpage and this
My main activity calls an AsyncTask when a user clicks a button. This AsyncTask
In this scenario: User enters some information into a textbox User clicks a button
The Simplified 7 Steps : [MainForm] User Clicks btnAdd Button AddForm will be shown
When the user clicks a button, I want his browser to automatically scroll to
My goal: the user clicks a button. From the button pops up a two-level
What I want to do is when a user clicks a button, to change

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.