最近公司代码质量检测,出来好多过时方法的使用,记录一下:
1.fromHtml
替换:
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
content.setText(Html.fromHtml(html.replaceAll("span style", "font color").replaceAll("span", "font").replaceAll("color:", ""),Html.FROM_HTML_MODE_LEGACY));
} else {
content.setText(Html.fromHtml(html.replaceAll("span style", "font color").replaceAll("span", "font").replaceAll("color:", "")));
}
2.new Date(.toLocaleString())
替换:
SimpleDateFormat sdf = (SimpleDateFormat) DateFormat.getDateTimeInstance();
sdf.format(new Date()