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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:57:52+00:00 2026-06-16T15:57:52+00:00

I have a Custom Array Adapter and i want to have an Image View

  • 0

I have a Custom Array Adapter and i want to have an Image View in the ListView.
This happens only on 2.2 and 2.3.X devices.

My Row Template is as Follows

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

    <ImageView
        android:id="@+id/place_category_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="8dp"
        android:background="@drawable/photo1"
        android:scaleType="centerCrop" >
    </ImageView>

    <TextView
        android:id="@+id/place_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_toLeftOf="@+id/list_timestamp"
        android:ellipsize="end"
        android:singleLine="true"
        android:text="Harsha Mallikarjun Vantagudi"
        android:textStyle="bold" >
    </TextView>

    <TextView
        android:id="@+id/place_distance"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_centerVertical="true"
        android:padding="6dp"
        android:paddingLeft="30dp"
        android:singleLine="true"
        android:text="2 hours" >
    </TextView>

</LinearLayout>

When i load the List. The Image is Displayed but the text Disappears when i try to scroll the text reappears at random and disappears.

enter image description here

enter image description here

Adapter

public class PlacesListAdapter extends ArrayAdapter<Place> implements
        Filterable {
    public Context context;
    private List<Place> places;

    public PlacesListAdapter(Context context, List<Place> places) {
        super(context, R.layout.list_item_place, places);
        this.context = context;
        this.places = places;

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View view = convertView;

        if (view == null) {
            LayoutInflater inflater;
            inflater = LayoutInflater.from(getContext());
            view = inflater.inflate(R.layout.list_item_place, null);
        }

        Place place = places.get(position);

        if (place != null) {

            TextView place_title = (TextView) view
                    .findViewById(R.id.place_name);
            TextView place_distance = (TextView) view
                    .findViewById(R.id.place_distance);

            if (place_title != null) {
                place_title.setText(place.getPlaceName());
            }

            if (place_distance != null) {
                place_distance.setText(place.getPlaceDistance());
            }
        }

        return view;
    }

}

TEST APK on 2.X device

  • 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-16T15:57:53+00:00Added an answer on June 16, 2026 at 3:57 pm

    I was wrong, I am using inflater:)

    This code for sure is working in android 2.3 and has image and text and is scrollable.

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            View rowView = inflater.inflate(R.layout.list_row, parent, false);
    
            ImageView imgThumb = (ImageView) rowView.findViewById(R.id.thumbnail);
            TextView tvDate = (TextView) rowView.findViewById(R.id.tvDate);
            TextView tvHeadline = (TextView) rowView.findViewById(R.id.tvHeadline);
            // Button btDetail = (Button)rowView.findViewById(R.id.btDetail);
    
            NewsHeadline newsHeadline = values.get(position);
            if (newsHeadline != null) {
                imgThumb.setImageBitmap(newsHeadline.getThumbnail());
                DateFormat df = SimpleDateFormat.getDateInstance();
                tvDate.setText(df.format(newsHeadline.getDate()));
                tvHeadline.setText(newsHeadline.getTitle());
            }
            return rowView;
        }
    

    The calling / setting code:

    protected void onPostExecute(String result) {
            Log.d("ReloadTask", "Done");
    
            newsListActivity.getListView().setAdapter(new               NewsDataArrayAdapter(newsListActivity, MyApplication.getListNewsHeadline()));
    

    and layout:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="fill_parent"
        android:layout_height="86dp"
        android:background="#363C4A"
        android:orientation="horizontal"
      >
    
        <!-- ListRow Left sied Thumbnail image -->
    
        <ImageView
            android:id="@+id/thumbnail"
            android:layout_width="80dip"
            android:layout_height="67dip"
            android:layout_alignLeft="@+id/lineBottom"
            android:layout_centerVertical="true"
            android:layout_marginRight="5dip" />
    
        <!-- Date -->
    
        <TextView
            android:id="@+id/tvDate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignTop="@+id/thumbnail"
            android:layout_marginLeft="10dp"
            android:layout_toRightOf="@+id/thumbnail"
            android:text="12.07.2012"
            android:textColor="#747474"
            android:textSize="11dip"
            android:textStyle="normal"
            android:typeface="sans" />
    
        <!-- headline -->
    
        <TextView
            android:id="@+id/tvHeadline"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/tvDate"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="1dip"
            android:layout_toLeftOf="@+id/tvDetail"
            android:layout_toRightOf="@+id/thumbnail"
            android:text="Just gona stand there and ... is multilined?"
            android:textColor="#d4d4d4"
            android:textSize="14dip"
            android:textStyle="bold" />
    
        <!-- Rightend Arrow -->
    
        <TextView
            android:id="@+id/tvDetail"
            android:layout_width="13dp"
            android:layout_height="19dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:background="@drawable/arrow" />
    
        <!-- Bottom Arrow -->
    
        <ImageView
            android:id="@+id/lineBottom"
            android:layout_width="288dip"
            android:layout_height="3dip"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:src="@drawable/line" />
    
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview connected to a custom array adapter. This list shows information
I have a listview with custom array adapter, the view allows the user to
I have list view with custom array adapter. I want to get items click
I have an array of custom objects. MyCustomArr[]. I want to convert this to
I have a custom adapter populating a listview. Each row has a checkbox which
I have a listview extends Activity and use custom adapter because I want icon
I have a ListView that has a custom ArrayAdapter with a custom XML row.
I have a ListView with a custom Adapter that extends ArrayAdapter. It's a ArrayAdapter
I have a custom list view with an image. I need to set the
when my ListView is being filled by a custom Array Adapter, I check for

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.