如何在android中设置编辑文本框的当前时间而不使用时间选择器?

如何在android中设置编辑文本框的当前时间而不使用时间选择器?,android,time,Android,Time,有谁能告诉我,在没有使用时间选择器的情况下,如何在android的编辑文本框中设置当前时间 edt_time=(EditText) findViewById(R.id.editText_time); Time t = new Time(); java.text.Time tf = android.text.format.Time.getCurrentTimezone(getApplicationContext()); edt_time.setText(tf.format(t));

有谁能告诉我,在没有使用时间选择器的情况下,如何在android的编辑文本框中设置当前时间

edt_time=(EditText) findViewById(R.id.editText_time);
Time t = new Time();
java.text.Time tf =  android.text.format.Time.getCurrentTimezone(getApplicationContext());
edt_time.setText(tf.format(t));     
请给我一些建议

谢谢你宝贵的时间

long time = System.currentTimeMillis(); // current time in miliseconds, conver it however you want
然后输入文本

editText.setText(String.valueOf(time));
同样,你也可以得到年、月、日等

上面的代码必须工作,但无论如何,请尝试此方法

SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String currentTime = sdf.format(new Date());
EditText edt_time=(EditText) findViewById(R.id.editText_time);
edt_time.setText(currentTime); 

你试过了吗anything@vinoth请再次访问我的问题是的,通过硬编码:D@freak但是我上面的代码在行中显示错误3@prabu请粘贴错误
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String currentTime = sdf.format(new Date());
EditText edt_time=(EditText) findViewById(R.id.editText_time);
edt_time.setText(currentTime);