I have a layout displayed on a button click.I want to hide that layout after 10 seconds.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(
The following piece of code hides your layout in 3 secs. You can change the time by changing the constant I have provided here for the delay.
private void HideLayout() {
final View view=volume_control_layout;
view.postDelayed(new Runnable() {
public void run() {
if(!volume_controller.isPressed())
{
view.setVisibility(View.INVISIBLE);
}
else
{
HideLayout();
}
}
}, 3000); // (3000 == 3secs)
}