This link above is checked and works fine. This is the code to call some method every second. You can change 1000 (= 1 second) at any time (e.g. 3 seconds = 3000)
public class myActivity extends Activity { private Timer myTimer; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); myTimer = new Timer(); myTimer.schedule(new TimerTask() { @Override public void run() { TimerMethod(); } }, 0, 1000); } private void TimerMethod() {
herokey
source share