1.在项目中调用用Intent传入url打开界面的时候,遇到了异常:
android.os.FileUriExposedException
解决方式:在Application的onCreate中加入以下代码,过滤掉FileUriExposedException的异常
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
StrictMode.setVmPolicy(builder.build());
}
2.判断Activity是否消亡的方式
@Override
protected void onPostExecute(Void result) {
final Activity activity = progressDialog.getOwnerActivity();
if (activity == null || activity.isDestroyed() || activity.isFinishing()) {
return;
}
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
}
}
3.创建handle
private final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
}
};