Android get current date and show it in TextView

前端 未结 10 2115
清歌不尽
清歌不尽 2021-02-14 09:23

I do not know what is wrong with code below -

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layo         


        
10条回答
  •  无人共我
    2021-02-14 09:45

        TextView tv = (TextView) findViewById(R.id.textView1);
        SimpleDateFormat dfDate_day= new SimpleDateFormat("E, dd/MM/yyyy HH:mm:ss");
        String dt="";
        Calendar c = Calendar.getInstance(); 
        data=dfDate_day.format(c.getTime());
        tv.setText(dt);
    

提交回复
热议问题