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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:53:46+00:00 2026-06-10T22:53:46+00:00

I have created a simple list consisting an ImageView and a TextView without using

  • 0

I have created a simple list consisting an ImageView and a TextView without using custom adapter class. I poked around the internet and found that most of the custom lists are created using a seperate adapter class… Here is my layout for the list row…

list_row.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <ImageView android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_launcher"
        android:layout_marginRight="15dp"/>

    <TextView android:id="@+id/list_item_id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:padding="15dp"
        android:textSize="15sp"/>

</LinearLayout>

MainActivity.java

    //Taking reference of a ListView
    ListView listView = (ListView) findViewById(R.id.list_view);

    //Setting up ArrayList to feed ArrayAdapter
    ArrayList<String> fruits= new ArrayList<String>();
    fruits.add("Apple");
    fruits.add("Mango");
    fruits.add("Strawberries");
    fruits.add("Grapes");

    //Setting up ArrayAdapter   
    ArrayAdapter<String> adapter = new ArrayAdapter<String>
            (this, R.layout.list_row, R.id.list_item_id, fruits);
    listView.setAdapter(adapter);

The above code is working fine…
I just want to know when to create the seperate Adapter class and what is the use of it?
In other words, what is the benefit of creating a seperate Adapter class?
Any help will be appreciated…
Thanks 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-06-10T22:53:48+00:00Added an answer on June 10, 2026 at 10:53 pm

    Are you even setting the TextView and the ImageView for each row in your ListView? Because it seems like you’re not. You’re giving every row in your list the same image and the text is being set by the Adapter.

    If you would want to send multiple Lists to your ArrayAdapter, you would have to write your own Adapter. Like when you fetch images and text for your ListView. You would have to write your own ArrayAdapter that will set the text and the images, by inflating them into every rowView with the corresponding text and image.

    Also this goes for more complex UI for each row, like this one:

    (source: addictivetips.com)

    Each row has multiple TextViews and Buttons and an ImageView inflated from a row.xml

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

Sidebar

Related Questions

I have created the simple list view with base adapter.Now I want to add
I have created a simple repository class that is returning a list of Projects:
I have a simple unordered list with list items as menu item i created
Could someone help me on this, I have created simple web services using axis2
I have created this simple program to learn shared_ptr using namespace std; #define Yes
i have created a simple public ref class in the vc++ project, which is
I have a simple record structure consisting of a header (H) and a list
I created one simple list view. i have two list view, my 1st list
I have created an IEnumerable list of racing drivers using LINQ from a string
I have created a simple List function but if I Loop through the List

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.