@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // TODO Auto-generated method stub Uri uri = Uri.parse( moeapk.ApkDownloadUrl( app_package, moeapk.current_apklist_vcode[position], moeapk.current_apklist_special[position])); // Intent intent = new Intent(Intent.ACTION_VIEW, uri); // startActivity(intent); DownloadManager mgr = (DownloadManager) getSystemService(DOWNLOAD_SERVICE); DownloadManager.Request request = new DownloadManager.Request(uri); request.setDestinationInExternalPublicDir( "MoeApk", moeapk.current_apklist_appname[position] + "_" + moeapk.current_apklist_vname[position] + "_" + moeapk.current_apklist_sname[position] + ".apk"); request.setAllowedNetworkTypes( DownloadManager.Request.NETWORK_MOBILE | DownloadManager.Request.NETWORK_WIFI); // 允许流量和wifi使用 request.setAllowedOverRoaming(false); // 不允许在漫游时下载 request.setMimeType("application/vnd.android.package-archive"); request.setTitle(moeapk.current_apklist_appname[position]); request.setDescription("来自萌萌安卓的下载"); request.setVisibleInDownloadsUi(true); long downloadid = mgr.enqueue(request); Toast.makeText( getApplicationContext(), "文件将保存在" + fileUtils.SDCARD + "MoeApk下", Toast.LENGTH_LONG) .show(); }