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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:19:14+00:00 2026-05-28T03:19:14+00:00

I am writing a music player that uses a custom Adapter extending BaseAdapter (efficiency

  • 0

I am writing a music player that uses a custom Adapter extending BaseAdapter (efficiency adapter) that I want to display in an AlertDialog using setAdapter() where the user can either click on one of the songs to switch to that position in the playlist OR check songs to remove from the playlist. I tried using a custom click listener so that a user could just long click to remove the item from the list but the listview just doesn’t work right… it was removing the wrong items (the ones at the end) even though the ArrayList contained the correct playlist items… (when I removed the item from the ArrayList, I passed it to the adapter which called notifyDataSetChanged… but that just didn’t work as I mentioned. There is definitely a bug in the AlertDialog ListView… because there is no reason for it to have popped off the results from the end rather than the correct item.

So… the next method I would like to try is to use the setMultiChoiceItems() method of the AlertDialog… but it appears that it doesn’t work with a custom adapter… only simple arrays. Will I have to subclass AlertDialog and Override the setMultiChoiceItems() method or is there a way I can make it work with an ArrayAdapter?

Basically, I can’t figure out how to even iterate the list that the AlertDialog creates or whether it even passes that view somehow. In addition, I don’t think I can even listen to clicks on checkboxes if I add those to the row. Any help will be greatly appreciated.

EDIT: Asking questions here is like magic… I answered my own question… this is how I did it. I added a hint to each checkbox which is the position of the item in the ArrayList. Then I used OnCheckedChangeListener to capture the selections. When you set a hint it adds text to the checkbox… since the background of the AlertDialog is white (even for clicked items?) I just set the hint text color to transparent.

holder.check.setHintTextColor(Color.TRANSPARENT);
holder.check.setHint(String.valueOf(position));
holder.check.setOnCheckedChangeListener(new OnCheckedChangeListener() {

public void onCheckedChanged(CompoundButton buttonView,
            boolean isChecked) {
        int position = Integer.parseInt((String) buttonView.getHint());
        Log.v("onCheckedChanged", "Checked: "+isChecked+" returned: "+position+" which should be "+getItem(position).name);                         
    }

});
  • 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-28T03:19:15+00:00Added an answer on May 28, 2026 at 3:19 am

    Refer This and This

    then
    Pass a reference to byte[] in setMultiChoiceItems().

    final boolean[] booleans = {false, true, false, true, false, false, false};
    

    Then check the value of booleans inside setPositiveButton().

    If you need to pass this AlertDialog around, then extend AlertDialog and have create a field boolean as described in 1.

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

Sidebar

Related Questions

I am writing a music player that I am trying to allow to go
I'm writing a music player in python, with a cli using urwid. I intend
I'm writing a music player using NAudio. Before I close the player, I would
I'm writing an iPhone app that uses OpenAL. When the application starts, the music
I'm writing an application that keep track of a library of music, and I
I'm writing a small system that will allow me to sell my band's music
I'm writing a simple music player, and I've created a playback service which implements
I´m writing a little audio player in c#. Now I want drag and drop
I'm writing a music app, and want to ask if there's a standard to
So I want to make a new music player for Android, it's going to

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.