I am new to Android.I have a problem with select an image and return result. I have a method is getImageFromGallery() my scope is this method call then i will choose a image from gallery and return as bitmap.But the problem is onActivityResult() set the bitmap after that bitmap is return. If i pick a image then, should return that selected image bitmap file.please help to find out the solution.
Here is my code.private Bitmap bitmap;
 public Bitmap getImageFromGallery(){
    Intent i = new Intent(
            Intent.ACTION_PICK,
            MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    startActivityForResult(i, RESULT_LOAD_IMAGE);
    return  bitmap;}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) {
        Uri selectedImage = data.getData();
        String[] filePathColumn = { MediaStore.Images.Media.DATA };
        Cursor cursor = getContentResolver().query(selectedImage,
                filePathColumn, null, null, null);
        cursor.moveToFirst();
        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
        String picturePath = cursor.getString(columnIndex);
        cursor.close();
        bitmap = BitmapFactory.decodeFile(picturePath);
    }
}
I want to return selected bitmap value.
 
    