Check bluetooth status from library.

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Check bluetooth status from library.

Postby mmenaker » Wed Oct 28, 2009 11:12 pm

Hi,

I have a library that is used by activities, but isn't an activity itself. So it doesn't have a context.

However I need to check if bluetooth is enable:

String BTstatus = android.provider.Settings.Secure.getString(getContentResolver(),
android.provider.Settings.Secure.BLUETOOTH_ON);

if(BTstatus.equalsIgnoreCase("1"))
{
...
}
else
{
...
}

However without a context, I can't seem to find a way to get the content resolver.

Is there any static functions I could use to get this?

I really don't want to have to have the activity pass the context down through numerous classes.

Thanks.
mmenaker
Freshman
Freshman
 
Posts: 6
Joined: Thu Jun 04, 2009 11:15 pm

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 8 guests