i have to find the size of an image retrieved from gallery and display it in text view of main activity. here is the code of retrieving the image from gallery into image view....
gallery_button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent i=new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i,RESULT_LOADIMAGE);
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==RESULT_LOADIMAGE&&resultCode==RESULT_OK&&null!=data)
Uri selectedImages=data.getData();
String[] filePathColon={MediaStore.Images.Media.DATA};
Cursor cursr=getContentResolver().query(selectedImages, filePathColon, null, null, null);
cursr.moveToFirst();
int columnindex=cursr.getColumnIndex(filePathColon[0]);
String picturepath=cursr.getString(columnindex);
cursr.close();
img.setImageBitmap(BitmapFactory.decodeFile(picturepath));