> Thanks Mark, great trick. > > Here's the code that worked: > > Intent bat = loader.registerReceiver(null, new > IntentFilter(Intent.ACTION_BATTERY_CHANGED)); > int level = bat.getIntExtra("level", 0); > int scale = bat.getIntExtra("scale", 100); > return level * 100 / scale;
BTW, there are some BatteryManager constants for those "level" and "scale" strings, though they only showed up in more recent editions of Android. Right now, you might need to use the string literals for backwards compatibility. -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en