title: How to show the name of the picture in the gallery by clicking on it?
body: <p>How to show the name of the picture in the gallery by clicking on it? </p>
  
  <p>i made an array of my images and I get the / sdcard / CameraExample / 28.06.2011_11-23-54.bmp, but it displays only 1 of 17. I would like to know how to remove a directory file, leaving only its name. and how do I assign getname each picture in the array?</p>
  
  <p>it's my sample code.</p>
  
  <pre><code> Gallery g = (Gallery) findViewById(R.id.Gallery01);  
  g.setAdapter(new ImageAdapter(this, ReadSDCard()));  
  
  final TextView label2 = (TextView)findViewById(R.id.TextView01);
  
  final TextView label = (TextView)findViewById(R.id.textView1);
  label.setText("Фото 0 из" + g.getAdapter().getCount());
  
  g.setOnItemClickListener(new OnItemClickListener() {  
      public void onItemClick(AdapterView&lt;?&gt; parent,  
        View v, int position, long id)  {
  
  
          label.setText("Фото"+" "+ ++position + " из " + parent.getCount());
  
          String dirPath = "/sdcard/CameraExample/";
          File f = new File(dirPath);
          File[] files = f.listFiles();
  
  
          for(int i=0; i &lt; files.length; i++)
          {
              File file = files[i];
              String fileName = file.getName();
              if (i == position)
              {
  
              label2.setText(fileName);
              }
  
  
  
  
          }
  
      }
  });  
  </code></pre>
  
  <p>Thanks</p>