title: android put icons to list (filebrowser)
body: <p>hi m making a filebrowser in android and this is the code for it :</p>
  
  <pre><code>public class FileBrowser extends ListActivity {
      private IAppManager imService;
  
      private File currentDir;
      private FileArrayAdapter adapter;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Editable usrr = Login.usernameText.getText();
          currentDir = new File("/sdcard/");
          fill(currentDir);
  
      }
      private void fill(File f)
      {
          File[]dirs = f.listFiles();
           this.setTitle(f.getName()+ "'s Chats" );
           List&lt;Option&gt;dir = new ArrayList&lt;Option&gt;();
           List&lt;Option&gt;fls = new ArrayList&lt;Option&gt;();
           try{
               for(File ff: dirs)
               {
                  if(ff.isDirectory())
                      dir.add(new Option(ff.getName(),"Folder",ff.getAbsolutePath()));
                  else
                  {
                      fls.add(new Option(ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath()));
                  }
               }
           }catch(Exception e)
           {
  
           }
           Collections.sort(dir);
           Collections.sort(fls);
           dir.addAll(fls);
          if(!f.getName().equalsIgnoreCase("sdcard"))
               dir.add(0,new Option("..","Parent Directory",f.getParent()));
           adapter = new FileArrayAdapter(FileBrowser.this,R.layout.filebrowser,dir);
  
           this.setListAdapter(adapter);
  
      }
      @Override
      protected void onListItemClick(ListView l, View v, int position, long id) {
          // TODO Auto-generated method stub
          super.onListItemClick(l, v, position, id);
          Option o = adapter.getItem(position);
          if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
              //v.setBackgroundResource(R.drawable.foler);
                    currentDir = new File(o.getPath());
                  fill(currentDir);
          }
          else
          {
  
              onFileClick(o);
  
          }
      }
  </code></pre>
  
  <p>now what i want is to display an icon for the files and the folders.(no other icons, just these 2) i have put an image view in the xml layout but i dont know how to dynamicaly check which list item is file so that it displays a file icon next to it and which one is a folder to display the folder icon.
  please help!</p>