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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:22:30+00:00 2026-05-27T20:22:30+00:00

I am trying to add titles per row using the LazyList, originally created by

  • 0

I am trying to add titles per row using the LazyList, originally created by Fedor (Lazy load of images in ListView)

The image below is what I want to accomplish. Please someone help me, I have been struggling for days trying to figure this out, I would really appreciate it a lot. Thanks in advance!

enter image description here

Here is LazyAdapter.java

package com.fedorvlasov.lazylist;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LazyAdapter extends BaseAdapter {

    private Activity activity;
    private String[] data;
    private static LayoutInflater inflater=null;
    public ImageLoader imageLoader; 

    public LazyAdapter(Activity a, String[] d) {
        activity = a;
        data=d;
        inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        imageLoader=new ImageLoader(activity.getApplicationContext());
    }

    public int getCount() {
        return data.length;
    }

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

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

    public View getView(int position, View convertView, ViewGroup parent) {
        View vi=convertView;
        if(convertView==null)
            vi = inflater.inflate(R.layout.item, null);

        TextView text=(TextView)vi.findViewById(R.id.text);;
        ImageView image=(ImageView)vi.findViewById(R.id.image);
        text.setText("item "+position);
        imageLoader.DisplayImage(data[position], image);
        return vi;
    }
}

and here is the item.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">
  <ImageView
      android:id="@+id/image"
      android:layout_width="50dip"
      android:layout_height="50dip" android:src="@drawable/stub" android:scaleType="centerCrop"/>
  <TextView
      android:id="@+id/text"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_weight="1" android:layout_gravity="left|center_vertical" android:textSize="20dip" android:layout_marginLeft="10dip"/>
</LinearLayout>
  • 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-27T20:22:31+00:00Added an answer on May 27, 2026 at 8:22 pm
        data = new ArrayList<Item>(10);
        data.add(new Item(100, "Sample Food1"));
        data.add(new Item(110, "Sample Food2"));
        data.add(new Item(120, "Sample Food3"));
        data.add(new Item(130, "Sample Food4"));
        data.add(new Item(140, "Sample Food5"));
        data.add(new Item(150, "Sample Food6"));
        data.add(new Item(160, "Sample Food7"));
        data.add(new Item(170, "Sample Food8"));
        data.add(new Item(180, "Sample Food9"));
        data.add(new Item(190, "Sample Food10"));
        data.add(new Item(200, "Sample Food11"));
        data.add(new Item(210, "Sample Food12"));
        adapter = new ItemListAdapter(this, data);
        setListAdapter(adapter);
    

    In case of ItemListAdapter Use this

    public class ItemListAdapter extends ArrayAdapter<Item>
    {
        private LayoutInflater li;
        public ItemListAdapter(Context context, List<Item> items)
        {
            super(context, 0, items);
            li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        }
        @Override
        public View getView(int position, View convertView, ViewGroup parent)
        {
            final Item item = getItem(position);
            View v = convertView;
            if (v == null)
            {
                v = li.inflate(R.layout.fooditem, null);
            }
            final TextView idView = (TextView) v.findViewById(R.id.itemId);
            if (idView != null)
            {
                idView.setText("" + item.getId());
            }
    
            final TextView captionView = (TextView) v.findViewById(R.id.itemCaption);
            if (captionView != null)
            {
                captionView.setText(item.getCaption());
            }
            return v;
        }
        @Override
        public long getItemId(int position)
        {
            return getItem(position).getId();
        }
        @Override
        public boolean hasStableIds()
        {
            return true;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to dynamically add titles to a number of images using values obtained
I'm trying to add the caption to the image title tag in wordpress so
I am trying to add and image and then put some text(title) on the
I am currently in the process of trying to add unique page titles and
I am trying to add some titles to my project. So, when my app
I'm trying to load images from Flickr's API into a Ruby on Rails app,
I'm trying to internationalize some titles in Birt. I'm using Birt report viewer and
i am trying to add the currency symbol to totalvalue by using following code
I'm trying to get an image to paint on the screen using java's Graphics2D.
I'm trying to display a list of titles in a modify/delete page. They load

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.