Solution to the camera that cannot display photos in the album after taking photos on Android system
Currently, I have achieved the effect by using sending broadcasts.
public void photo() { Intent openCameraIntent = new Intent(.ACTION_IMAGE_CAPTURE); startActivityForResult(openCameraIntent, TAKE_PICTURE); }
Solution:
protected void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case TAKE_PICTURE: if ( resultCode == RESULT_OK) { String fileName = (()); Bitmap bm = (Bitmap) ().get("data"); (bm, fileName); String imagePath = +fileName + ".JPEG"; //Show the photos you just took in the album Uri localUri = (new File(imagePath)); Intent localIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, localUri); sendBroadcast(localIntent); } break; }
Thank you for reading, I hope it can help you. Thank you for your support for this site!