I'm a newbie in Android.Here, I have a Checkbox in my Activity. What I actually want is, on enabling the Checkbox ,my BroadcastReceiver needs to respond. So for that what do I do? How is it done.
Can anyone give a sample code for doing that?
Can you please tell me whether I can do this:
public MyActivity extends Activity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
....
.....
.....
//Check a condition and if its true declare a BroadcastReceiver like this here
class MyReceiver extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent) {
// do something
}
}
Thanks in Advance