Android|Android 我常出现的错误

错误1. 使用 Timer timer = new Timer(); timer运行多个timertask时,如果一个抛出异常,其他任务都会停止
解决:使用ScheduledExecutorService代替。
Android|Android 我常出现的错误
文章图片
image.png 【Android|Android 我常出现的错误】错误2.使用已过时的方法。
1)getNetworkInfo、
NetworkInfo getActiveNetworkInfo() 获取可用网络(可用)
NetworkInfo[] getAllNetworkInfo 获取所有可用网络(已经过时)
NetworkInfo getNetworkInfo(int networkType) 获取固定网络信息 (已经过时)
2)getChildPosition更换为getChildLayoutPosition
3)百度定位监听registerLocationListener内使用BDAbstractLocationListener。

    推荐阅读