1.

Warning:

// To get local formatting use getDateInstance(), getDateTimeInstance(), or

// getTimeInstance(), or use new SimpleDateFormat(String template, Locale

// locale) with for example Locale.US for ASCII dates.@SuppressLint("SimpleDateFormat")

String string = new SimpleDateFormat("EEEE yyyy-MM-dd",Locale.getDefault()).format(new Date());

Solution:

添加Locale.getDefault()

for example,like:

SimpleDateFormat newSimpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日HH时mm分",Locale.getDefault());


2.Warning:

Implicitly using the default locale is a common source of bugs: Use toUpperCase(Locale) instead

String string = new SimpleDateFormat("EEEE",Locale.getDefault()).format(new Date()).toUpperCase();


Solution:

由于大写一般只应用在英语国家,所以Locale指定为Locale.US

String string = new SimpleDateFormat("EEEE",Locale.getDefault()).format(new Date()).toUpperCase(Locale.US);

(有时警告提示仍在,需要clean下才会消除)


未完待续......

更多相关文章

  1. 解决Android(安卓)Studio报的警告:Resource IDs will be non-fina
  2. android 各种常用,不易记的dialog,等控件整理
  3. Android(安卓): Android(安卓)Studio 3.4更新至gradle 5.1.1的问
  4. Android添加圆角渐变色按钮
  5. Your anti-virus program might be impacting your build perfor
  6. 去掉 Android工程中让人很不爽的“黄色警告”
  7. Android最新获取oaid的方法及sdk
  8. Android英语单词记忆程序源码
  9. 去除警告 Android(安卓)NDK: WARNING: APP_PLATFORM Android-14

随机推荐

  1. 关于android 布局中诡异的AttributeSet
  2. Android通知Notification
  3. 【Android】定义HttpPost连接超时
  4. Android向桌面添加快捷方式,使其指向特定
  5. android联系人过滤
  6. android 自定义组件随着手指自动画圆
  7. android MediaRecorder录音
  8. android网络状态检查
  9. android中opengl es基本方法使用说明
  10. Android vlc 简单使用