java - Android Camera Intent calling onCreate again -
i'm developing application calls camera, takes image , create thumbnail. working until now...i don't know reason, when takes image , click on "save" (android's default) oncreate method called.
so, load of thumbnail not working anymore
i tried modify android manifest:
<uses-feature android:name="android.hardware.screen.portrait" /> <activity android:name=".myactivity" android:configchanges="orientation|keyboardhidden|screensize" android:screenorientation="portrait"> </activity> oncreate still called.
method take picture:
public void takepicture() { intent intent = new intent(mediastore.action_image_capture); filehelper filehelper = new filehelper(this); fileuri = filehelper.savefile(); intent.putextra(mediastore.extra_output, fileuri); // start image capture intent startactivityforresult(intent, constantshelper.capture_image_activity_request_code); } is there way prevent "oncreate" called after taking picture?
thanks!
no. need prepare code such works across natural activity lifecycle. whether or not previous activity instance remain live when comes foreground depends on device (how much memory available app, whether "don't maintain activities" checked under developer options, etc.)
it's case valid, , expected happen on platform, , activity should able handle saving , restoring state if it's killed off.
whatever state you're initializing in oncreate(), create sure retain in onsaveinstancestate(), , when oncreate() happens again, check if savedinstancestate non-null. if it's not, restore whatever state saved , go on on.
java android
No comments:
Post a Comment