android passing values to another activity but cannot read -
i trying pass values new activity cannot read values new activity.
here code,
intent myintent = new intent(photo2activity.this, mainactivity.class); myintent.putextra("image1", image1); myintent.putextra("image2", image2); myintent.putextra("image3", image3); myintent.putextra("konteyner_no", _txt_konteyner_id.gettext().tostring()); myintent.putextra("mahalle", _txt_mahalle.gettext().tostring()); myintent.putextra("sokak", _txt_sokak.gettext().tostring()); myintent.putextra("konteyner_temizmi", _check_konteyner_temizmi.ischecked()); myintent.putextra("yaninda_cop_varmi", _check_yaninda_cop_varmi.ischecked()); myintent.putextra("aralarinda_cop_varmi", _check_aralarinda_cop_vardi.ischecked()); myintent.putextra("zamansiz_cop_varmi", _check_zamansiz_cop_vardi.ischecked()); myintent.putextra("cop_obekleri_vardi", _check_cop_obekleri_vardi.ischecked()); myintent.putextra("note", _txt_note.gettext().tostring()); startactivity(myintent); how read them new activity(mainactivity)?
convert bitmap byte array:-
bitmap bmp = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher); bytearrayoutputstream stream = new bytearrayoutputstream(); bmp.compress(bitmap.compressformat.png, 100, stream); byte[] bytearray = stream.tobytearray(); pass byte array intent:-
intent intent = new intent(mainactivity.this, nextactivity.class); intent.putextra("picture", bytearray); startactivity(intent); get byte array bundle , convert bitmap image:-
bundle extras = getintent().getextras(); byte[] bytearray = extras.getbytearray("picture"); bitmap bmp = bitmapfactory.decodebytearray(bytearray, 0, bytearray.length); imageview image = (imageview) findviewbyid(r.id.imageview1); image.setimagebitmap(bmp); passing primitive types check link below
Comments
Post a Comment