Code example for ImageView

Methods: setImageBitmapsetVisibility

0
                    path = fileManagerString;
                } 
                Util.debug("Imagepath: '" + path + "'.");
                Bitmap bitmap = Util.decodeBitmap(path, 800);
                image = Util.bitmapToBytes(bitmap);
                attachImage.setImageBitmap(bitmap);
                attachButton.setVisibility(View.GONE);
                attachImage.setVisibility(View.VISIBLE);
            } 
        } 
    } 
 
    private String getPath(Uri uri) {
        String[] projection = {MediaStore.Images.Media.DATA};
        Cursor cursor = getActivity().managedQuery(uri, projection, null, null, null);
        if (cursor != null) {
            // HERE YOU WILL GET A NULLPOINTER IF CURSOR IS NULL 
            // THIS CAN HAPPEN IF YOU USED OI FILE MANAGER FOR PICKING THE MEDIA 
            int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            cursor.moveToFirst();
            return cursor.getString(column_index);