Android Open Source - MotorIndia Custom List

From Project

Back to project page MotorIndia.


The source code is released under:

GNU General Public License

If you think the Android project MotorIndia listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package spider.motorindia;
//w w w  .  j  a v  a  2s.  c  o  m

import com.squareup.picasso.Picasso;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class CustomList extends ArrayAdapter<String>{

  private final Activity context;
  private final String[] title;
  private final String[] imageurl;

  //constructor of this class, this called when we initialize the adapter
  public CustomList(Activity context,String[] title, String[] imageurl) {
    super(context, R.layout.single_line, title);
    this.context = context;
    this.title = title;
    this.imageurl = imageurl;

  public View getView(int position, View view, ViewGroup parent) {
    LayoutInflater inflater = context.getLayoutInflater();
    //TODO WHY??
    View rowView= inflater.inflate(R.layout.single_line, null, true);
    TextView txtTitle = (TextView) rowView.findViewById(;
    ImageView imageView = (ImageView) rowView.findViewById(;
    Picasso.with(context).load(imageurl[position]).placeholder(R.drawable.ic_launcher).error(R.drawable.error).resize(200, 150).into(imageView);
    // set the according title for this row by selecting the title from 'position'
    return rowView;

Java Source Code List