Untitled

 avatar
unknown
plain_text
2 months ago
1.2 kB
1
Indexable
new Thread(new Runnable() {

                public void run() {
                    long timerEnd = System.currentTimeMillis() + 60 * 1000;

                    while (timerEnd >  System.currentTimeMillis()) {

                        progress = 60 - (int) (timerEnd - System.currentTimeMillis()) / 1000;
                        // Update the progress bar

                        progressHandler.post(new Runnable() {
                            public void run() {                     
                                    progressBarHorizontal.setProgress(progress);                    
                            }                   
                        });

                        try {
                            Thread.sleep(500);
                        } catch (InterruptedException e) {
                            Log.w("App","Progress thread cannot sleep");
                        }
                    }
                    progressHandler.post(new Runnable() {
                        public void run() {                     
                                okButton.performClick();                    
                        }                   
                    });
                }
            }).start(); 
Leave a Comment