android - Intent camera from landscape orientation result error -


my app take photo using intent. if take portrait orientation, image. when rotate device , take landscape orientation, got error. error message pointing (maybe) wrong line.

open camera:

intent takepictureintent = new intent(mediastore.action_image_capture); if (takepictureintent.resolveactivity(mainactivity.getpackagemanager()) != null) {     startactivityforresult(takepictureintent, request_image_capture); } 

on activity result:

bundle extras = data.getextras(); imagebitmap = (bitmap) extras.get("data"); ivimage.setimagebitmap(imagebitmap); 

giving result explained. try again other code.
open camera:

intent intent = new intent(mediastore.action_image_capture); fileuri = getoutputmediafileuri(media_type_image); intent.putextra(mediastore.extra_output, fileuri); startactivityforresult(intent, request_image_capture); 

on activity result:

bitmapfactory.options options = new bitmapfactory.options(); options.insamplesize = 4; imagebitmap = bitmapfactory.decodefile(fileuri.getpath(), options); ivimage.setimagebitmap(imagebitmap); 

still have same result.
after looking solution, said save instance. put (i use fragment)

@override public void onsaveinstancestate(bundle outstate) {     outstate.putparcelable("file_uri", fileuri);     super.onsaveinstancestate(outstate); }  @override public void onactivitycreated(bundle savedinstancestate) {     if (savedinstancestate != null)         fileuri = savedinstancestate.getparcelable("file_uri");     super.onactivitycreated(savedinstancestate); } 

still not working , 1 of error message pointing

super.oncreate(savedinstancestate); 

in oncreate(bundle savedinstancestate) function

anyone know why? or maybe alternate code using camera.

update, error message:

could not find class 'android.transition.transition', referenced method mypackagename.fragment.homefragment.access$super

and warning message

unable resolve virtual method 949: landroid/graphics/bitmap;.getallocationbytecount

add following code in manifest

<activity     android:name=".activityname"     android:configchanges="orientation|screensize|keyboardhidden"/> 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -