Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating gallery after taking pictures Gallery not showing all the pictures Android Camera
    primarykey
    data
    text
    <p>I am using a onClick over a button to capture an image.</p> <pre><code>PictureCallback myPictureCallback_JPG = new PictureCallback() { @Override public void onPictureTaken(byte[] arg0, Camera arg1) { FileOutputStream outStream = null; try { // Write to SD Card outStream = new FileOutputStream(String.format("/sdcard/%d.jpg", System.currentTimeMillis())); outStream.write(arg0); outStream.close(); Toast.makeText(Photo.this, "Image Saved to SD Card", Toast.LENGTH_SHORT).show(); System.out.println(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } camera.startPreview(); }}; </code></pre> <p>The image gets saved in the SD card. Then the user clicks on Send button and a layout opens, on Click of ImageView an Image Gallery opens and clicking on a particular image, the URI gets selected.</p> <pre><code> imageAttachPhoto = (ImageView)findViewById(R.id.imageViewPhotoOne); imageAttachPhoto.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE); } }); } public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == SELECT_PICTURE) { Uri selectedImageUri = data.getData(); selectedImagePath = getPath(selectedImageUri); System.out.println("Image Path : " + selectedImagePath); imageAttachPhoto.setImageURI(selectedImageUri); } } } public String getPath(Uri uri) { String[] projection = { MediaStore.Images.Media.DATA }; Cursor cursor = managedQuery(uri, projection, null, null, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); return cursor.getString(column_index); } </code></pre> <p>But I am not able to view images snapped in Gallery code, but could see the images through FileBrowser and when I open the SD card in PC I can see the image and then the Android shows the image in Gallery also with in the code. Let me know what the issue is and how to solve it, looking forward to your reply. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload