本地BR的getRelativeTimeSpanString中的UnknownFormatConversionException

时间:2013-05-27 06:17:19

标签: android android-date

在我的应用程序中,有一个时间戳字符串,它是这样创建的:

public String getTimestamp(Date when) {
    long now = System.currentTimeMillis();
    long past = when.getTime();
    return DateUtils.getRelativeTimeSpanString(
             past, 
             now, 
             DateUtils.SECOND_IN_MILLIS);
}

在巴西的设备中运行此功能时,出现以下错误:

java.util.UnknownFormatConversionException: Conversion: l
at java.util.Formatter$FormatToken.unknownFormatConversionException(Formatter.java:1430)
at java.util.Formatter$FormatToken.checkFlags(Formatter.java:1367)
at java.util.Formatter.transform(Formatter.java:1473)
at java.util.Formatter.doFormat(Formatter.java:1101)
at java.util.Formatter.format(Formatter.java:1062)
at java.util.Formatter.format(Formatter.java:1031)
at java.lang.String.format(String.java:2177)
at java.lang.String.format(String.java:2151)
at android.text.format.DateUtils.getRelativeTimeSpanString(DateUtils.java:526)
at android.text.format.DateUtils.getRelativeTimeSpanString(DateUtils.java:426)
at com.myapp.Utils.MyAdapter.bindView(MyAdapter.java:98)
at com.myapp.Utils.MyAdapter.getView(MyAdapter.java:60)
at android.widget.AbsListView.obtainView(AbsListView.java:1618)
at android.widget.ListView.makeAndAddView(ListView.java:1772)
at android.widget.ListView.fillDown(ListView.java:695)
at android.widget.ListView.fillFromTop(ListView.java:752)
at android.widget.ListView.layoutChildren(ListView.java:1609)
at android.widget.AbsListView.onLayout(AbsListView.java:1448)
at android.view.View.layout(View.java:7375)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
at android.view.View.layout(View.java:7375)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7375)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7375)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
at android.view.View.layout(View.java:7375)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7375)
at com.slidingmenu.lib.CustomViewAbove.onLayout(CustomViewAbove.java:476)
at android.view.View.layout(View.java:7375)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912)
at android.view.View.layout(View.java:7375)
at android.widget.FrameLayout.onLayout(FrameLayout.java:338)
at android.view.View.layout(View.java:7375)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1158)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1878)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3770)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:912)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
at dalvik.system.NativeStart.main(Native Method)

对于为什么会发生这种情况以及如何解决这个问题的任何想法? 这是BR问题的Android问题吗?

0 个答案:

没有答案