android - onActivityResult is not called -
I need to send a byte array from any activity to another. I have something like this: I am creating a photo and I want to send the The problem is that it is not called in See in the documentation of putExtras: extended The data should include a package prefix in the intent, for example, app com. Android Contacts will use names like "com.android.contacts.ShowAll". Instead of putting bundles in mind: You can try but byteearray directly: Why not called onActivityResult: When you set the results, you use the code FOTO_MODE: But onActivityResult, you check the code: you do this and instead System.out To use .println ("onactivity result" + resultcode); Activity1 - & gt;
Activity 2 - & gt; <1
byte [] image data to Activity1 to display it. For this, I have 2 in Activity 2:
Camera. Illustration Callback mPictureCallback = New Camera.Picture Callback () {Zero Drawing on Public (Byte [] ImageData, Camera c) {if (imageData! = Null) {Lephoto = 1; PrefsEditor.putInt (TAKEPHOTO, TEKPHOTO); PrefsEditor.commit (); System.out.println ("image data in tech PHOTO" + image data); Intent mIntent = new intent (); Bundle B = new bundle (); B.putbyteArray ("imageData", ImageData); MIntent.putExtras (b); SetResult (FOTO_MODE, mIntent); End(); } MCamera.startPreview (); MPreviewRunning = true}}; In
Activity 1 , on
onactive result () I have it:
@ Override Secure Zero OnActivityResult (int Requestcode, Integer Results Code, Intent Data) {takephoto = myPrefs.getInt (TAKEPHOTO, 0); Println ("OnActivityResult" + resultCode); If (resultCode == RESULT_OK) if (lephoto == 1) {toast. Make Text (this, "11", Toast. LNNGHHHARAT) Show (); Bitmapfactor Option option = new bitmapfile Option (); Options.inSampleSize = 3; Byte [] imageData = data.getByteArrayExtra ("ImageData"); System.out.println ("image data in photo" + image data); Bitmap myImage = BitmapFactory.decodeByteArray (image data, 0, imageData.length, options); Matrix mat = new matrix (); Mat.postRotate (90); BitmapResult = bitmap.centbitmap (myImage, 0, 0, myImage.getWidth), myImage.getHeight (), mat, true); Myadapter.notifyDataSetChanged (); }}
Activity1
onActivityResult and I can not see where my argument is I have been working in and I have tested this code in Eclipse, and it works fine. Can somebody help me out?
add a set of
Bundle B = new bundle (); B.putbyteArray ("imageData", ImageData); MIntent.putExtras (b);
mIntent.putExtra ("imageData", imageData);
set resolle (FOTO_MODE, mIntent);
resultCode == RESULT_OK
If (resultCode == FOTO_MODE) {// Then all your things to get data from intent}}
Use:
Logd.d ("Myclass", "Onactive Results" + resultcode);
Comments
Post a Comment