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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:51:23+00:00 2026-05-25T16:51:23+00:00

I am working in android. I am creating a music application. in this application

  • 0

I am working in android. I am creating a music application. in this application i want to show title of song and name of artist into list.
this is my code :-

 String[] title_of_song={"title1","title2","title3","title4","title5"};
 String[] artist_of_song={"artist1","artist2","artist3","artist4","artist5"};
 ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.row_button, R.id.TextView_songName, title_of_song);


 ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this, R.layout.row_button, R.id.TextView_byArtist, artist_of_song);

 list.setAdapter(adapter);
 list.setAdapter(adapter1); //**this is creating error**

this is creating problem that list is unable to setAdapter two times. so please tell me solution for it so i can set setAdapter for both title of song and artist name.
this is creating problem that list is unable to setAdapter two times. so please tell me solution for it so i can set setAdapter for both title of song and artist name.

Thank you in advance.

  • 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-25T16:51:23+00:00Added an answer on May 25, 2026 at 4:51 pm

    I do not know what are you trying to achieve. both your adapters have identical codes. why not create a single adapter that has values of both adapters.

    Just saw your edited question

    create a custom adapter and inflate a layout which has two textviews – one for artist and one for the song.

    class TaskAdapter extends ArrayAdapter{
    
        ArrayList artist, song;
        public TaskAdapter(ArrayList songs, ArrayList artist){
               this.artist = artist;
               this.song = songs;
        }       
    
    
        public TaskAdapter(Context context, int textViewResourceId ) {
            super(context, textViewResourceId);
    
        }
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
    
            View v = convertView;
            ViewHolder holder;
            if(v == null) {
                LayoutInflater li = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                v = li.inflate(R.layout.custom_list, null);
                holder = new ViewHolder();
                holder.taskId = (TextView)v.findViewById(R.id....);
                holder.taskDesc = (TextView)v.findViewById(R.id....);
    
                v.setTag(holder); 
            }
            else{
                holder = (ViewHolder)v.getTag();
            }
    
            holder.tArtist.setText(artist.get(position));
    
            holder.tSong.setText(song.get(position));           
    
    
            return v;
        }       
    
    }   
    static class ViewHolder {
        TextView tArtist;
        TextView tSong;     
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a Android APP. In this application I have window for
i am working on android. i am creating a login button. i want that
Currently I am working on an Android application that is dynamically creating controls. Everytime
I am working in android, i want to make a scrollview. this is my
I am currently working on a C-based, NDK-based, Android application. This application needs to
I am working in android. I want to parse my json data. This is
I am working on a shopping cart application for Android. While creating package design,
I'm working on a client-server Android application and trying to figure out how to
I'm working on connecting an android app in Java with google app engine. This
I'm new on android programming and i'm working on android application and i'm stuck

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.