friends,
i am trying to display image from gallery now i want to put check if selected file is image then it should be displayed.
using following code any one help me out how to achieve this?
User can select video file, image file etc.. anything so i want to allow only images.
ON button click
private void SelectImageFromGallery()
{
startActivityForResult(new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI),0);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
switch( resultCode )
{
case 0:
Log.i( "MakeMachine", "User cancelled" );
break;
case -1:
_data = data;
ShowImageInActivity();
break;
}
}