I am trying to send m image which is selected by either gallery or camera to another activity but nothing seems to be happening, I have converted the Bitmap to string to send it over the intent but it seems that the intent never gets invoked.
Please help me what am i doing wrong?
this is my onActivityResult() Code
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Bitmap thumbnail = null;
if(requestCode==RESULT_LOAD_IMAGE){
if(resultCode==RESULT_OK){
Uri selectedImageUri = data.getData();
String[] filePathColumn = { MediaStore.Images.Media.DATA };
Cursor cursor = getContentResolver().query(selectedImageUri,filePathColumn, null, null, null);
cursor.moveToFirst();
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
String picturePath = cursor.getString(columnIndex);
cursor.close();
data.getExtras().get("data");
thumbnail = (BitmapFactory.decodeFile(picturePath));
//CONVERT BITMAP TO STRING
ByteArrayOutputStream baos=new ByteArrayOutputStream();
thumbnail.compress(Bitmap.CompressFormat.PNG,100, baos);
byte [] b=baos.toByteArray();
String temp=Base64.encodeToString(b, Base64.DEFAULT);
//trying to start activity...
Intent intent = new Intent(Home.this, Upload.class);
intent.putExtra("picture", temp);
startActivity(intent);}
}
}
}