Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid activity-reset after picture taken (orientation?)
    primarykey
    data
    text
    <p>Well basically, I press a button, this opens up your default camera app by using the camera intent. After a picture is taken, it will save the things needed and redirect to another activity.</p> <p>In this activity, I have an AsyncTask that can succesfully upload pictures. So what is my problem you may ask. My problem is that it re-creates my activity and therefore reset my ProgressDialog together with it. ( It runs the activity, does the aSyncTask, dies before it can finish it and re-creates my Activity to do the asynctask once again. )</p> <p>It does not always do this. I think it does this because it changes the Orientation from the phone from Landscape to Portrait. ( I have a Samsung. When I go to the Camera it changes to landscape and when I finish it, it goes back to portrait. )</p> <p>I've already done my homework and added these things to my manifest:</p> <pre><code>android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait" &gt; </code></pre> <p>I've made sure to "lock" my app in the portrait orientation but I still see my app change orientation and I believe this is why my activity gets re-created.</p> <p>I was planning to add all kinds of checks but I believe this is not the right way to handle this situation, since it sometimes does not re-create the activity.</p> <p>The check I am talking about is to use:</p> <pre><code>protected void onSaveInstanceState(Bundle outState) { outState.putString("started", "1"); } </code></pre> <p>Anyway, can somebody help me out? I just want it to load the activity without it self-destructing on me.</p> <p>PS: The VM doesn't have any problems. The VM loads the activity and finishes it without re-creating it.</p> <p>PPS: Did extra testing, on my Samsung if I keep it on landscape-mode it will work. So it is definately the camera that is destroying my activity with it's orientation change.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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