To fetch images on SD Card.Uri will be
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI
onActivityResult method:
protectedvoid onActivityResult(int requestCode,int resultCode,Intent intent)
{super.onActivityResult(requestCode, resultCode, intent);
if(resultCode == RESULT_OK)
{
Uri photoUri = intent.getData();
if(photoUri !=null)
{
try
{Bitmap bitmap =MediaStore.Images.Media.getBitmap(this.getContentResolver(), photoUri);
//Now you can upload this bitmap to server or do something else.
}catch(Exception e)
{
e.printStackTrace();
}
}
}
}
全站熱搜