Android how to make Battery charging animation
Try TransitionDrawable to accomplish this.
Step 1 - In an xml file in the drawable folder you create something like below:
<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Set your different images for each drawable-->
<item android:drawable="@drawable/state_1" />
<item android:drawable="@drawable/state_2" />
<item android:drawable="@drawable/state_3" />
<item android:drawable="@drawable/state_4" />
<item android:drawable="@drawable/state_5" />
</transition>
Step 2 - Then, in your View xml for the actual ImageView, set reference this TransitionDrawable in the android:background
attribute.
Step 3 - In your code at appropriate place, initiate the transition as below:
TransitionDrawable transition = (TransitionDrawable) viewObj.getBackground();
transition.startTransition(transitionTime);
Hope this helps.
Animation in status bar in Android
Starter class should implement also stop logic.
Something like:
class Starter implements Runnable {
boolean stopConditionMet = false;
public void run() {
BatteryAnimation.start();
try {
while (!stopConditionMet) { Thread.sleep(500); }
} catch (InterruptedException e) {}
BatteryAnimation.stop();
}
public void stop() { stopConditionMet=true; }
}
(instead of busy wait you can do this with wait()-notifyAll() scheme. The above example if for simplicity).
.. and you'll need to keep the instance of the Starter class inside your Activity. Declaring it anonymously won't allow you to change its value when you need.
Where is the charging animation file on a SGS3 mini
Through my experience with this try the following files:
/system/bin/lpmkey
Or the like.
Liquid level animation( Battery Doctor )
I have finally found a library: WaveView
https://github.com/john990/WaveView
Edit
This library https://github.com/gelitenight/WaveView also does the same thing with more features. You can :
- Shift the wave horizontally.
- Set water level.
- Set vertical size of wave.
- Set horizontal size of wave.
Custom Android battery icon while phone is charging
If you want an animated icon then you should probably create a widget, you can create one that is similar to an icon but that can be animated when the battery is charging.
For the animation you can use the link posted on the comment of Thomas K.
Related Topics
How to Unlock Android Phone Through Adb
How to Avoid Overlap View in Relative Layout in Android
Remove Old and Add New Git in Android Studio
How to Remove the Black Bar Appearing At the Bottom
Socket.Io Client Getting Connected Disconnected Repeatedly
How to Change Background Color of Layout of List-View Item Using Array-Adapter
How to Change Styling of Textinput Placeholder in React Native
Android Textview Text Not Getting Wrapped
Android:Strike Out Text With Bold or Thicker Line Than Default Strike_Thru_Text_Flag
Alarm Manager Won't Work When the App Is Killed in the Background and Device Is Locked
Onclicklistener Does Not Work in Fragment
Import Android.Support.V7.App Cannot Be Resolved
How to Add/Remove Object in Recyclerview Using Arraylist in Android
Android:Get Current Date and Time from Firebase
How to Get the Current Time on a Button Click