Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final BatteryProgressView bat = new BatteryProgressView(this);
- bat.setLayoutParams(new LinearLayout.LayoutParams(250, 250));
- linear1.addView(bat);
- bat.setProgress(66);
- final android.os.Handler handler = new android.os.Handler();
- handler.postDelayed(new Runnable() {
- @Override
- public void run() {
- bat.setProgress(63);
- if (bat.getProgress() <= 70) {
- Toast.makeText(getApplicationContext(), "Battery level is low", Toast.LENGTH_SHORT).show();
- }
- handler.postDelayed(new Runnable() {
- @Override
- public void run() {
- bat.setProgress(77);
- if (bat.getProgress() <= 70) {
- Toast.makeText(getApplicationContext(), "Battery level is low", Toast.LENGTH_SHORT).show();
- }
- }
- },1000);
- }
- },2000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement