Reputation: 441
I have an AlarmActivity with main.xml layout. And an alarm class that extends BroadcastReceive and a method onReceive. I want to get the value from EditText in main.xml into my onReceive method in the alarm class.
Upvotes: 1
Views: 152
Reputation: 13501
Why don't keep that value in SharedPreference and fetch it in Receiver... A reliable way to do... The current approach fails since you never know whether the Activity holding EditText lives or not..
Upvotes: 1
Reputation: 13541
I dont think you understand how a BroadcastReceiever works. Its Asynchronus, meaning that an Activity may not be up at that time, but you can launch something given the BroadcastReciever's Context. Change your approach.
Upvotes: 1