Why does the installed android image disappear?

I am trying to send an image taken from Camera , I am using the following code

 Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(i, REQ_CODE_PHOTO_TAKE); 

inside onActivityResult i wrote this code

 Bitmap photo = (Bitmap) data.getExtras().get("data"); mainImage.setImageBitmap(photo); 

Update

 <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> 

This code works fine on almost all devices, but I ran into a problem in the LG Lucid VS840 , where the default camera mode is landscape. After capturing the image, if I press the ok button, the image will remain visible for seconds and then disappear. At that time, I literally see a change in camera mode.

I wrote android:configChanges="orientation|keyboardHidden" in AndroidManifest.xml , but this did not work.

You can find the video link here: Link

I tested this code on the following devices where it worked.

  • Sony xperia U
  • Samsung Galaxy Nexus
  • Motorola droid RAZR
  • Samsung ACE
+4
source share
1 answer

What is your target SDK version? You need to put screenSize if it is above 13.

Link: http://developer.android.com/guide/topics/manifest/activity-element.html#config

See note for orientation .

0
source

Source: https://habr.com/ru/post/1479722/


All Articles