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

  • Home
  • SEARCH
  • 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 5946435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:49:22+00:00 2026-05-22T16:49:22+00:00

I am developing an android media player. I am new to ANDROID. I am

  • 0

I am developing an android media player. I am new to ANDROID. I am using the following code to show all the music from a query result. I want every song once, but it showing a single song more than once and ignoring many others, if I set the text size in the adapter view as in the following code. How can I set the text size in the adapter view and avoid this problem?

Thank u

public class MusicAdapter extends BaseAdapter {
        private Context mContext;

        public MusicAdapter(Context c) {
              mContext = c;
        }

        public int getCount() {
              return count;
        }

        public Object getItem(int position) {
              return position;
        }

        public long getItemId(int position) {
              return position;
        }

        public View getView(int position, View convertView, ViewGroup parent) {
              System.gc();
              TextView tv = new TextView(mContext.getApplicationContext());
              tv.setTextSize(25);                     //THE PROBLEM IS HERE
              String id = null;
              if (convertView == null) {
                    music_column_index = musicCursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DISPLAY_NAME);
                    musicCursor.moveToPosition(position);
                    id = musicCursor.getString(music_column_index);
                    music_column_index = musicCursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID);
                    musicCursor.moveToPosition(position);
                    String artist = musicCursor.getString(music_column_index);
                    id += "Artist:" + artist;
                    tv.setText(id);
              } else
                    tv = (TextView) convertView;
              return tv;
        }
  }
  • 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-22T16:49:23+00:00Added an answer on May 22, 2026 at 4:49 pm

    I have solved it by using SimpleCursorAdapter like below. It is a built in adapter, which is really smart. This link helped me a lot

    And you should never set android:layout_height=”wrap_content” of a listview. It causes the repeating occurrence of list items.

    ListAdapter adapter = new SimpleCursorAdapter(this,
                // Use a template that displays a text view
                R.layout.list_item,
                // Give the cursor to the list adatper
                musicCursor,
                // Map the NAME column in the people database to...
                new String[] { MediaStore.Audio.Media.TITLE,
                MediaStore.Audio.Media.ARTIST },
                // The "text1" view defined in the XML template
                new int[] { R.id.music_title, R.id.music_artist });
        setListAdapter(adapter);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an Android media player streaming application. I get the following exception:
I have been developing Android application where I use this code: Date d=new Date(new
I am developing media player and my application download mp3 file from server .
Im developing an android App I want to read the data in from Excel
I'm developing a media player application in Android. I've an animation (Open Gl Surface
I'm currently developing an Android application that fetches images using http requests. It would
Has anybody had any success with developing for Android platform using Netbeans (5.5+ )
HI all, I'm just getting started with developing for Android. I'm looking to port
I'm developing chess game for Android ( androidchess.appspot.com ). If I want to add
I'm new at android developing. I'm trying to make a simple drumset app, when

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.