i am developing an android app i need to go from one activity to another in that first i need to change the colors of button then a delay (so that the) and then call this same function(the one i am in rite now)
in objective-c it is done with [self performSelector:foo afterDelay:2]
so i need to the its java equivalent.
For delayed actions in Android I'd recommend using the Android Handler
class with its postDelayed()
method.
Create a handler for your Activity
as a member variable:
private Handler mHandler = new Handler();
And then add your delay action as follows:
mHandler.postDelayed(new Runnable() {
public void run() {
//Do you thing here
}
},2000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With