下面是我的下载代码:
这个程序为啥直接跳到下载失败了?
public void onClick(DialogInterface dialog, int which) {
//下载新版本的apk,替换安装
HttpUtils httpUtils = new HttpUtils();
final File file = new File(Environment.getExternalStorageDirectory(),"xx.apk");
httpUtils.download(info.downloadurl, file.getAbsolutePath(), false, new RequestCallBack() {
@Override
public void onSuccess(ResponseInfo<File> arg0) {
ToastUtils.show(SplashActivity.this, "下载成功");
//替换安装apk
Intent intent = new Intent();
intent.setAction("android.intnet.action.VIEW");
intent.addCategory("android.intent.actegory.DEFAULT");
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
startActivity(intent);
}
@Override
public void onFailure(HttpException arg0, String arg1) {
ToastUtils.show(SplashActivity.this, "下载失败");
}
log里面打印的错误是:09-18 17:21:39.442: W/InputMethodManagerService(1005): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@b6645758 attribute=null