读书人

Android 下载一个资料以及打开这个apk

发布时间: 2012-08-13 13:21:53 作者: rapoo

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

读书人网 >Android

热点推荐