小编Sid*_*idd的帖子

android.text.format.Time替换需要,因为它已被弃用

我是android新手,我有使用Time对象需要使用的代码.有人可以在不使用Time类的情况下帮助我实现相同的功能.

Time dayTime = new Time();
dayTime.setToNow();

// we start at the day returned by local time. Otherwise this is a mess.
int julianStartDay = Time.getJulianDay(System.currentTimeMillis(), dayTime.gmtoff);

// now we work exclusively in UTC
dayTime = new Time();
long dateTime;

// Cheating to convert this to UTC time, which is what we want anyhow
// this code below is in a for loop
dateTime = dayTime.setJulianDay(julianStartDay + i);
day = getReadableDateString(dateTime);
Run Code Online (Sandbox Code Playgroud)

android

10
推荐指数
2
解决办法
7997
查看次数

标签 统计

android ×1