Disable button on an Android app for a specific period of time

前端 未结 1 529
心在旅途
心在旅途 2021-01-24 08:56

I\'m building a login style application within android studio. As part of this I have created a rule that if the counter which monitors the number of invalid login attempts, get

相关标签:
1条回答
  • 2021-01-24 09:24

    Use following code. it will disabled button after 5 seconds when activity or fragment start when you put in OnCreate() method.

    new Handler().postDelayed(new Runnable() 
        {
            public void run() 
            {
                b1.setEnabled(false);
            }
        }, 5000    //Specific time in milliseconds
    );
    
    0 讨论(0)
提交回复
热议问题