2

I have an onClick method set in the xml layout file that triggers the vibration of the phone for 100ms at this point I have the ImageView Visibility set to visible so it can be seen. I want the ImageView to be set back to gone again when the vibration has stopped. How do I go about this?

SamRowley
  • 3,435
  • 7
  • 48
  • 77

1 Answers1

11

You can start this method at the same time:

public void timerDelayRemoveView(float time, final ImageView v) {
    Handler handler = new Handler(); 
    handler.postDelayed(new Runnable() {           
        public void run() {                
            v.setVisibility(View.GONE);      
        }
    }, time); 
}
jcxavier
  • 2,232
  • 1
  • 15
  • 24
Lumis
  • 21,517
  • 8
  • 63
  • 67
  • You are welcome. You can animate the removal of your view by calling another method from here and passing your view as a parameter... to spice it up ;) – Lumis Jan 25 '11 at 15:56