android - onActivityResult is not called -


I need to send a byte array from any activity to another. I have something like this: Activity1 - & gt; Activity 2 - & gt; <1

I am creating a photo and I want to send the 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 (); }}   

The problem is that it is not called in 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?

See in the documentation of putExtras:

add a set of

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:

  Bundle B = new bundle (); B.putbyteArray ("imageData", ImageData); MIntent.putExtras (b);   

You can try but byteearray directly:

  mIntent.putExtra ("imageData", imageData);   

Why not called onActivityResult:

When you set the results, you use the code FOTO_MODE:

  set resolle (FOTO_MODE, mIntent);   

But onActivityResult, you check the code:

  resultCode == RESULT_OK   

you do this

  If (resultCode == FOTO_MODE) {// Then all your things to get data from intent}}   

and instead System.out To use .println ("onactivity result" + resultcode);
Use:

  Logd.d ("Myclass", "Onactive Results" + resultcode);    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -