Android 下载一个文件以及打开这个apk文件
下载一个网络文件的函数如下
如果是一个apk文件,打开并且安装的函数为private void openFile(File file) { // TODO Auto-generated method stub Log.e("OpenFile", file.getName()); Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); startActivity(intent); }
转自:http://ice-k.iteye.com/blog/997423