相关疑难解决方法(0)

如何在Android上创建本地化的时间前的String

我正在审核Google I/O Session 2012应用程序并遇到了这个TODO

public static String getTimeAgo(long time, Context ctx) {
    if (time < 1000000000000L) {
        // if timestamp given in seconds, convert to millis
        time *= 1000;
    }

    long now = getCurrentTime(ctx);
    if (time > now || time <= 0) {
        return null;
    }

    // TODO: localize
    final long diff = now - time;
    if (diff < MINUTE_MILLIS) {
        return "just now";
    } else if (diff < 2 * MINUTE_MILLIS) {
        return "a minute ago";
    } …
Run Code Online (Sandbox Code Playgroud)

android localization

9
推荐指数
2
解决办法
4764
查看次数

标签 统计

android ×1

localization ×1