1

i have opened activity with disabled button, this activity when it opened automatically sends SMS message(Query Message) to our service provider . (that's the mission of this activity ).

NOW the trick i have broadcastreceiver listen to reply of my Query Message in some conditions i want to Enable button on the already opened activity .

in simple words - i want to enable, the disabled button in activity according of received message in broadcastreceiver while activity opened?

thanks

Shridutt Kothari
  • 7,326
  • 3
  • 41
  • 61
Realbitt
  • 388
  • 6
  • 18
  • http://stackoverflow.com/questions/14364632/update-active-activity-ui-with-broadcastreceiver http://stackoverflow.com/questions/14643385/how-to-update-ui-in-a-broadcastreceiver seesm these questions might have answers already – sandrstar Feb 27 '13 at 09:42
  • try using a background thread to check the reception of the msg and enable the button from a handler :) – Athul Harikumar Feb 27 '13 at 09:52

1 Answers1

1

If you already have registered BroadcastReceiver in this activity than just use setEnabled(true) in onReceive method:

@Override
public void onReceive(Context context, Intent intent) { 
     button.setEnabled(true);
}
EvZ
  • 11,889
  • 4
  • 38
  • 76