I followed the post from
https://stackoverflow.com/a/10168114/5078763
and
http://www.theappguruz.com/blog/android-take-photo-camera-gallery-code-sample
edited the code as below
My App is crashing at
MediaStore.Images.Media.getBitmap
It executes below Bfr Log
Log.d("TAG", "onActivityResult: bfr");
But not Afr Log
Log.d("TAG", "onActivityResult: Afr");
My Completed Code as below :
void calGlryImjPkrFnc()
{
Intent glrImjPkrVar = new Intent(Intent.ACTION_PICK,
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
glrImjPkrVar.setType("image/*");
startActivityForResult(glrImjPkrVar , 1);
}
void calCamImjPkrFnc()
{
Intent camImjPkrVar = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(camImjPkrVar, 2);
}
protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent)
{
super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
Bitmap pkdImjBitmapVar = null;
if(requestCode == 1 && resultCode == RESULT_OK)
{
Log.d("TAG",requestCode + "");
if (imageReturnedIntent != null)
{
try
{
ContentResolver contntMgrVaj = getApplicationContext().getContentResolver();
Uri uriVaj = imageReturnedIntent.getData();
Log.d("TAG", "onActivityResult: bfr");
pkdImjBitmapVar = MediaStore.Images.Media.getBitmap(contntMgrVaj, uriVaj);
Log.d("TAG", "onActivityResult: Afr");
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
else if(requestCode == 2 && resultCode == RESULT_OK)
{
pkdImjBitmapVar = (Bitmap) imageReturnedIntent.getExtras().get("data");
}
imjVyuVar.setImageBitmap(pkdImjBitmapVar);
}
Help me to Fix this crash