Hi Friends, if you like my blog please give your valuable comments it will help to improve my blog content and enthusiasm to write a lot in android World.

Tuesday, May 21, 2013

Display the path of selected Picture in gallery

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

Gallery click = (Gallery) findViewById(R.id.gallery);

  final List<String> sdcard = ReadSDCard();
  click.setAdapter(new ImageAdapter(this, sdcard));
    
  click.setOnItemClickListener(new OnItemClickListener()
 {
      public void onItemClick(AdapterView<?> parent,
           View v, int position, long id) {
         Toast.makeText(Galleryy.this,
    (CharSequence)sdcard.get(position),
    Toast.LENGTH_LONG).show();
      }
  });
}