i'm trying to send a byte[] from one activity to another. in the recieving activity the byte[] seems to be null after getting the intent extras. any ideas?
thanks.
Button save = (Button)findViewById(R.id.save);
save.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
touchView.isSaved = true;
Bundle bundle = new Bundle();
bundle.putByteArray("byteArr", touchView.data);
Intent intent = new Intent(mContext, SavePic.class);
intent.putExtra(bundle );
startActivity(intent);
}}) ;
.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.savepic);
final EditText edittext = (EditText) findViewById(R.id.edittext);
edittext.setText("");
edittext.setOnKeyListener(new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
// If the event is a key-down event on the "enter" button
if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
(keyCode == KeyEvent.KEYCODE_ENTER)) {
// Perform action on key press
Bundle extras = getIntent().getExtras();
byte [] arr = extras.getByteArray("byteArr");
if(arr != null){
Log.e("xxxxxx", "********* arr not null");
}else{
Log.e("xxxxxx", "********* arr is null");
}
final Bitmap mCBitmap2 = BitmapFactory.decodeByteArray(arr, 0, arr.length);
.
[updated] i've changed the key values so the are not the same data/bytrArr, also the intent now just passes a Bundle