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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:33:22+00:00 2026-06-16T09:33:22+00:00

I’m trying to make listView with custom adapter and multiselection. My adapter looks like

  • 0

I’m trying to make listView with custom adapter and multiselection.
My adapter looks like this:

public class MusicPopupListAdapter extends BaseAdapter {

Cursor cursor;
Context context;
public MusicPopupListAdapter(Context context) {
    this.context = context;
    Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
    String[] cursor_cols = {
            MediaStore.Audio.Media._ID,
            MediaStore.Audio.Media.ARTIST,
            MediaStore.Audio.Media.ALBUM,
            MediaStore.Audio.Media.TITLE,
    };
    String where = MediaStore.Audio.Media.IS_MUSIC + "=1";
    cursor = context.getContentResolver().query(uri, cursor_cols, where, null, null);
}


@Override
public int getCount() {
    return cursor.getCount();
}

@Override
public Track getItem(int position) {
    cursor.moveToPosition(position);
    Track track = new Track();
    track.id = cursor.getLong(cursor.getColumnIndex(MediaStore.Audio.Media._ID));
    track.album = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM));
    track.artist = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST));
    track.title = cursor.getString(cursor.getColumnIndex(MediaStore.Audio.Media.TITLE));
    return track;
}

@Override
public long getItemId(int position) {
    Track track = getItem(position);
    return track.id;
}


@Override
public View getView(int position, View convertView, ViewGroup parent) {
    RowHandler handler;
    if (convertView == null) 
    {
        convertView = LayoutInflater.from(context).inflate(R.layout.row, parent, false);
        handler = new RowHandler();
        handler.artist = (TextView) convertView.findViewById(R.id.artist);
        handler.album = (TextView) convertView.findViewById(R.id.album);
        handler.title = (TextView) convertView.findViewById(R.id.title);
        convertView.setTag(handler);
    }
    else
        handler = (RowHandler)convertView.getTag();
    Track track = getItem(position);
    handler.artist.setText(track.artist);
    handler.album.setText(track.album);
    handler.title.setText(track.title);
    return convertView;
}

public static class Track {
    long id;
    String artist;
    String album;
    String title;
}

public static class RowHandler {
    TextView artist;
    TextView album;
    TextView title;
}

As layout for row, I’m using extended relative layout:

public class CheckableRelativeLayout extends RelativeLayout implements Checkable {

boolean checked = false;
public CheckableRelativeLayout(Context context) {
    super(context);
}

public CheckableRelativeLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public CheckableRelativeLayout(Context context, AttributeSet attrs, int style)
{
    super(context, attrs, style);
}

@Override
public boolean isChecked() {
    return checked;
}

@Override
public void setChecked(boolean checked) {
    this.checked = checked;
}

@Override
public void toggle() {
    checked=!checked;
}

In debug I see, that setChecked is calling, but always with false value.

And I set Choice mode for listView to ListView.CHOICE_MODE_MULTIPLE.
What am I missing?

  • 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-16T09:33:23+00:00Added an answer on June 16, 2026 at 9:33 am

    I found solution. The problem was with popup window. By default popup window was created in non-focusable mode. Solution is in setting popup windows focusable = true.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,

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.