提问者:小点点

Android Studio中的LocationUpdates模块-我怎样才能将日期与时间一起包含,并让它与坐标一起更新?


以下是它当前更新所依赖的代码:

        mLastUpdateTimeTextView.setText(String.format(Locale.ENGLISH, "%s: %s",
                mLastUpdateTimeLabel, mLastUpdateTime));

我试了一下:

SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss", Locale.getDefault());
String currentDateandTime = sdf.format(new Date());
mLastUpdateTimeTextView.setText("Date/Time:"+ " " + currentDateandTime);

以及至少打印的日期和时间。 但是,它不更新坐标。 知道怎么用坐标更新吗?


共1个答案

匿名用户

明白了。

已更改

mLastUpdateTime = DateFormat.getTimeInstance().format(new Date());

mLastUpdateTime = DateFormat.getDateTimeInstance().format(new Date());