title: unable to get high quality bitmap from camera
body: <p>i need to get captured picture from camera but it seem this code:</p>
  
  <pre><code>Intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageUri);
  </code></pre>
  
  <p>stops activity from getting to <code>onActivityResult</code> and throw an exception like this:</p>
  
  <pre><code>java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity
  </code></pre>
  
  <p>thats what i figured out from 5 hours searching.</p>
  
  <p>this is my code:
  intent</p>
  
  <pre><code>File mediaStorageDir = new File(Environment.getExternalStorageDirectory() + "/Files");
  String timeStamp = new SimpleDateFormat("ddMMyyyy_HHmmss").format(new Date());
  String mImageName = "MI_" + timeStamp + ".jpg";
  File mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName);
  imageUri = Uri.fromFile(mediaFile);
  Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
  cameraIntent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageUri);
  filePath = imageUri.getPath();
  Log.e("000", filePath + " :|");
  startActivityForResult(cameraIntent, 0);
  </code></pre>
  
  <p>at Log line i get the path but when i press save on camera app i get error and a null <code>filePath</code> </p>
  
  <pre><code>Bitmap bitmap = BitmapFactory.decodeFile(filePath);
  appPanel.setBitmap(bitmap);
  </code></pre>
  
  <p>this code is fine but returns a low quality image:</p>
  
  <pre><code>Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
  </code></pre>
  
  <p><strong>Finally i found the solution:</strong></p>
  
  <p>we must save the path at <code>onSaveInstanceState</code> as below:</p>
  
  <pre><code>@Override
  protected void onSaveInstanceState(Bundle outState) {
  super.onSaveInstanceState(outState);
  
  CharSequence userText = CapturedPath;
  outState.putCharSequence("savedText", userText);
  }
  </code></pre>
  
  <p>and bring it back on <code>onRestoreInstanceState</code></p>
  
  <pre><code>@Override
  protected void onRestoreInstanceState(Bundle savedInstanceState) {
  super.onRestoreInstanceState(savedInstanceState);
  
  CapturedPath =savedInstanceState.getCharSequence("savedText").toString();
  
  //Load bitamp from here:
  Bitmap bitmap = BitmapFactory.decodeFile(CapturedPath);
  appPanel.setBitmap(bitmap);
  
  }
  </code></pre>