Android Open Source - iSiteProyect File Array Adapter

From Project

Back to project page iSiteProyect.


The source code is released under:

Copyright (C) 2013 Plasty Grove <> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Softwar...

If you think the Android project iSiteProyect 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 com.iSiteProyect;
//from  w  w  w  .  j a v a  2 s . c o  m
import java.util.List; 
import android.content.Context; 
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 FileArrayAdapter extends ArrayAdapter<Item>{

  private Context c;
  private int id;
  private List<Item>items;
  public FileArrayAdapter(Context context, int textViewResourceId,
      List<Item> objects) {
    super(context, textViewResourceId, objects);
    c = context;
    id = textViewResourceId;
    items = objects;
  public Item getItem(int i)
     return items.get(i);
       public View getView(int position, View convertView, ViewGroup parent) {
               View v = convertView;
               if (v == null) {
                   LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                   v = vi.inflate(id, null);
               /* create a new view of my layout and inflate it in the row */
           //convertView = ( RelativeLayout ) inflater.inflate( resource, null );
               final Item o = items.get(position);
               if (o != null) {
                       TextView t1 = (TextView) v.findViewById(;
                       TextView t2 = (TextView) v.findViewById(;
                       TextView t3 = (TextView) v.findViewById(;
                       /* Take the ImageView from layout and set the city's image */
                     ImageView imageCity = (ImageView) v.findViewById(;
                     String uri = "drawable/" + o.getImage();
                       int imageResource = c.getResources().getIdentifier(uri, null, c.getPackageName());
                       Drawable image = c.getResources().getDrawable(imageResource);
               return v;


Java Source Code List