Using checkbox to enable eventlistener

Posted by Lefty on Stack Overflow See other posts from Stack Overflow or by Lefty
Published on 2011-03-05T23:21:02Z Indexed on 2011/03/05 23:24 UTC
Read the original article Hit count: 200

Filed under:
|
|

I have looked for a solution to this for days and days. The examples I found don't make sence to me, probably because I am both old and new (old to life and new to android/jave).

I would like to add a checkbox to my preference activity that would either enable or disable receivers. This is for a service which will run in the background, at boot completed, and will depend on two things 1)is the preference true and 2) is wifi enabled.

So it would work something like this; user turns on phone boot completed checks if receivers are enabled (set by checkboxpreference) if checkboxpreference is true - looks for wifi if wifi is true - registers receivers

Also required would be if wifi or checkboxpreference goes "false", unregister receivers.

Thanks

© Stack Overflow or respective owner

Related posts about service

Related posts about checkbox