1

I'm developing an app with an account system linked to Firebase.

Well, the sign up process takes a few seconds and I wish to implement a rotating loading icon like this one in the action bar:

enter image description here

The only problem is that I don't know how to make the menu item rotate and how to disable it's onClick feature.

LarsH
  • 27,481
  • 8
  • 94
  • 152
Roman Dev
  • 103
  • 2
  • 11

1 Answers1

1

Use Runnable to set the images from the drawables with Thread.sleep(10);.

 new Thread(new Runnable() {
        @Override
        public void run() {
            stuff();
            finish();
        }
    }).start();

And

public void stuff(){
    for (int i=0;i<50;i+=5){ //put i< the number of images you have
        try {                //for your animation.
            Thread.sleep(10);
            //set your image here.
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
Simo
  • 345
  • 4
  • 12