1

With my program I launch a activity that show a fake alertdialog for battery low. Now I want change also the icon battery on status bar but this is a system icon and there is not api for to do this. I found on the Internet this not public API http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.5_r4/com/android/server/status/StatusBarIcon.java but I have a problem for this line :

1) View v = inflater.inflate(com.android.internal.R.layout.status_bar_icon, parent, false);

2) AnimatedImageView im = (AnimatedImageView)v.findViewById(com.android.internal.R.id.image);

because on official API there is not a com.android.internal.R.layout.status_bar_icon or com.android.internal.R.id.image I tried to replace with costant int value but for first line I get View v = com.android.server.status.statusbarview@44f0a2c0 but for second line I get AnimatedImageView im = null :-(

How can I do it?

I can not do it, I thought of creating a transparent activity in fullscreen modo and notitle and put my fake battery image on the top and with layout margin left put it over the battery icon. I tried it but my image go under the status bar...why ?? :-(

Mimmo
  • 37
  • 1
  • 3
  • 1
    If you find a way to do this, you're gonna be a big hit with the battery salesmen. – Blumer Feb 10 '11 at 21:49
  • If you're talking about wanting your background activity or service to put an overlay on top of the home screen or other apps... recent versions of android will always put the status bar on top of such an overlay. It's a security thing, to prevent people from doing exactly what you're describing wanting to do. – Don Hatch Apr 20 '18 at 10:34

1 Answers1

3

Mimmo,

As far as I know, the only way to change the battery icon in the status bar would be a custom ROM. I don't believe it can be done programmatically, even with root access.

Will Tate
  • 33,439
  • 9
  • 77
  • 71