I am going to make a simple Alarm Clock, I have user interface and I am using Bundle to send user configurations(Like volume value or tone type) for Alarm.
In main Activity I have:
Bundle b = new Bundle();
b.putString("tone", toneS.getSelectedItem().toString());
And I send it to BroadcastReceiver:
Intent intent = new Intent(SetAlarm.this, MessageReceiver.class);
intent.putExtras(setBoundle());
And I receive the Bundle in BroadcastReceiver in this way:
Bundle b2 = new Bundle();
b2 = intent.getExtras();
It works perfectly for the first time but after it although Bundle in the main activity has new data from UI but BroadcastReceiver just keep the old data.
Can anyone explain the issue?
Whenever I’ve done this I make a new Bundle in the sending end and put the string in that.
The Intent on the sending end can be reused as much as you like
Hope this helps!