Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving photo in Android to sd card and show them in bitmap in other intent
    text
    copied!<p>I need a help with this Android application! I'm at very beginning in developing on Android and for a school's project I have to create an App that scan qr's codes and shoot photo.</p> <p>I have a problem on shooting photo, I'd like to shoot the photo, confirm it pressing "tick button", open a new intent that allow you to add a comment on Image, and then through another button I'll ad inside an ArrayAdapter.</p> <p>I'll try to show you the parts of the code that have problem, if anything more is needed just ask!</p> <p>The method TakePhoto is inside a Fragment that launch the camera intent pressing a button.</p> <p>public void TakePhoto() {</p> <pre><code> Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); int imageNum = 0; File imagesFolder = new File(Environment.getExternalStorageDirectory(),"aMuse"); imagesFolder.mkdirs(); String fileName = "image_" + String.valueOf(imageNum) + ".jpg"; File output = new File(imagesFolder, fileName); while (output.exists()){ imageNum++; fileName = "image_" + String.valueOf(imageNum) + ".jpg"; output = new File(imagesFolder, fileName); } Uri uriSavedImage = Uri.fromFile(output); intent.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage); getActivity().startActivityForResult(intent, 100); } </code></pre> <p>The onActivityResult is inside a FragmentActivity that contains 2 more Fragment, and I'll need to pass the image shooted to another intent (imageResult) that will show the photo shooted and permit to add comment through an EditText.</p> <p>public void onActivityResult(int requestCode, int resultCode, Intent intent) {</p> <pre><code> super.onActivityResult(requestCode, resultCode, intent); IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { Intent qrResult = new Intent(this, QrResult.class); String resultString = scanResult.getContents(); qrResult.putExtra(EXTRA_MESSAGE, resultString); startActivity(qrResult); } else{ switch (requestCode) { case 100: if (resultCode == Activity.RESULT_OK) { Intent imageResult = new Intent(this, ImagePreview.class); startActivity(imageResult); } } </code></pre> <p>}</p> <p>In this situation the app (as I understood) save the photo inside SD/aMuse with name image_nn.jpg. What I need to do is get this photo and set inside imageResult as bitmap. I tried passing the uri through .putExtra method but it crash giving "null pointer exception" error.</p>
 

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