Skip to content

Thread Code Android Studio to handle time:

FiveD edited this page Sep 29, 2018 · 1 revision

Thread Code:

Thread t=new Thread(){ @Override public void run(){ while(!isInterrupted()){ try { Thread.sleep(1000); //1000ms = 1 sec runOnUiThread(new Runnable() { @Override public void run() { count++; textView.setText(String.valueOf(count)); } }); } catch (InterruptedException e) { e.printStackTrace(); } } } }; t.start();

Clone this wiki locally