Basically, I'm creating a camera class and in camera class I'm calling an intention to use the phone camera . However, I am not able to receive and display images because I am not using the startActivityForResult method in the classroom. The StartActivityForResult method does not work in my class so I use the startActivity method instead I tried to create a class method to pass the bitmap of images to the main activity SOS, which I can display in the image view in the image view but this Does not work If you have suggestions for my problem, then my code is:
import java.io.File; Import android App Import android.content.Context; Import android.content.Intent; Import Android.graphics. Bitmap; Import android.net.Uri; Import android.os environment; Import android Prozar Mediastore; Import android.view.View; Importroid.os.Bundle; Public Category Character LiBRRI {Personal Final Reference mContext; Private Bitmap Image Bitmap; Private bundle bundle; Public static string log tag = "cam"; Private static image = 1; Private Uri image Yuri; // class constructor public camera: alberry (reference reference) {this.mContext = context; } Public Zero Lefoto (see V) {intent = intent ("android.media.action.IMAGE_CAPTURE"); File photo = new file (EnvironmentalGetEnsteenStorozporic Directory (Environmental DIRECTORY_PICTURES), "pic.jpg"); Intent.putExtra (MediaStore.EXTRA_OUTPUT, Uri.fromFile (photo)); ImageUri = Uri.framefile (photo); MContext.startActivity; }}
You should use the startActivityForResult (intent, requestcode) < / Code> Activity instead of just beginning you will handle the result in override method
onActivityResult ()
See full details.
A word of caution in handling images from the camera in a non-native app - Images can often exceed the 16 MB limit given for non-native apps, this means that if you have your own If you do not scale the images properly, then your virtual machine will be out of memory!
No comments:
Post a Comment