Android开发Android新科技Android开发经验谈

Android 我常出现的错误

2018-12-12  本文已影响6人  Android戴勤学

错误1. 使用 Timer timer = new Timer();timer运行多个timertask时,如果一个抛出异常,其他任务都会停止
解决:使用ScheduledExecutorService代替。

image.png

错误2.使用已过时的方法。
1)getNetworkInfo、
NetworkInfo getActiveNetworkInfo() 获取可用网络(可用)
NetworkInfo[] getAllNetworkInfo 获取所有可用网络(已经过时)
NetworkInfo getNetworkInfo(int networkType) 获取固定网络信息 (已经过时)

2)getChildPosition更换为getChildLayoutPosition
3)百度定位监听registerLocationListener内使用BDAbstractLocationListener。

上一篇 下一篇

猜你喜欢

热点阅读