Can't pass and retrieve CharSequence to another activity using intent.getExtras() method.
- by vt
Activity 1:
Intent i = new Intent(this, Activity2.class);
CharSequence btText = btButton.getText();
i.putExtra(BUTTON_TEXT, btText);
startActivityForResult(i, ACTIVITY_SETTINGS);
Activity 2:
in onCreate:
Bundle extras = getIntent().getExtras();
if (extras != null) {
mButtonText = extras.getCharSequence(Activity1.BUTTON_TEXT);
}
The resulting CharSequence is not what was passed, it's something like "(id=830066506776)" instead.
This works:
CharSequence test2 = getIntent().getCharSequenceExtra(Activity1.BUTTON_TEXT);
What is wrong with getExtras approach? This is what they used in Notepadv3 example.
This is for Android 2.1.
Thank you.