Note that there are some explanatory texts on larger screens.

plurals
  1. POCamera intent problem, camera is starting without request
    text
    copied!<p>I have a little problem with my camera intent. As I know, when camera orientation is changed, activity is restarted. Okej, I am using the code bellow. </p> <pre><code> @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); app = (myApplication)getApplication(); if(savedInstanceState ==null ) getFullImage(null); else{ String somevalue = savedInstanceState.getString("uri"); getFullImage(somevalue); } } private void getFullImage(String testValue) { if(testValue == null){ Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); file = new File(Environment.getExternalStorageDirectory(), UUID.randomUUID()+ ".jpg"); outputFile = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFile); startActivityForResult(intent, TAKE_PICTURE); }else { outputFile = null; Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); file = new File(testValue); outputFile = Uri.fromFile(file); intent.putExtra(MediaStore.EXTRA_OUTPUT, testValue); startActivityForResult(intent, TAKE_PICTURE); finishFromChild(getParent()); } </code></pre> <p>}</p> <pre><code>@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode == RESULT_CANCELED) { Log.i(TAG, "Back Button"); finishFromChild(this); } else if(requestCode == TAKE_PICTURE &amp;&amp; resultCode == RESULT_OK) { //I'm creating new file here (for this question is irelevant) } catch (IOException e) { e.printStackTrace(); } Intent myIntent = new Intent(getBaseContext(), com.test.activities.SaveFileActivity.class); myIntent.putExtra("image", newPath); startActivityFromChild(this, myIntent, SAVE_ITEM); finishFromChild(this); } </code></pre> <p>}</p> <pre><code>@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putString("uri",outputFile.getPath()); } </code></pre> <p>After picture is captured, I press DONE button and I go to SaveFileActivity. Everyting works fine, until I try from SaveFIleActivity to go to another activity, then camera is starting again. Where should I look for the problem ? Maybe I should kill camera intent, but when ?</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