Hi ,
which way is best in performance is Handler or timer i need to
update textview as timer every second need to update time so which one
will be best please tell the reason. because i need the reason thanks in
advance
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
timer = (TextView) findViewById(R.id.timer);
// handler.post(mRunnable);
task = new UpdateTimeTask();
handler.post(task);
}
private Runnable mRunnable = new Runnable() {
@Override
public void run() {
timer.setText(dateFormat.format(new Date()));
handler.postDelayed(mRunnable, 1000);
}
};
class UpdateTimeTask extends TimerTask {
public void run() {
timer.setText(dateFormat.format(new Date()));
handler.postDelayed(task, 1000);
}
}
--
Regards,
Perumal.N
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en