title: Android custom Listadapter
body: <p>I want to let the adapter check if the submitted value is a file
  but when I check
  it only checks the first value so
  for eg.</p>
  
  <p>I submit</p>
  
  <p>app (directory)
  meta (directory)</p>
  
  <p>this shoul look like this :</p>
  
  <p>app with the directory icon
  meta with the directory icon</p>
  
  <p>but the out put is only app as directory</p>
  
  <p>The adapter:</p>
  
  <pre><code>package org.alexander.fuchs.compress;
  import java.io.File;
  
  import android.app.Activity;
  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 adapter extends ArrayAdapter&lt;String&gt; {
      private final Activity context;
      private final String[] names;
  
      static class ViewHolder {
          public TextView text;
          public ImageView image;
      }
  
      public adapter(Activity context, String[] names) {
          super(context, R.layout.rowlayout, names);
          this.context = context;
          this.names = names;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          View rowView = convertView;
          if (rowView == null) {
              LayoutInflater inflater = context.getLayoutInflater();
              rowView = inflater.inflate(R.layout.rowlayout, null);
              ViewHolder viewHolder = new ViewHolder();
              viewHolder.text = (TextView) rowView.findViewById(R.id.label);
              viewHolder.image = (ImageView) rowView
                      .findViewById(R.id.icon);
              rowView.setTag(viewHolder);
          }
  
          ViewHolder holder = (ViewHolder) rowView.getTag();
          String s = names[position];
          holder.text.setText(s);
  
  
  
               File entry = new File(s);
  
              if(entry.isDirectory() == true)
              {
              holder.image.setImageResource(R.drawable.ok);
              }
              else
              {
              holder.image.setImageResource(R.drawable.no);
              }
  
  
  
          return rowView;
      }
  }
  </code></pre>