-2
我有下面的代码:如何创建应用程序“保存应用程序中的文件,但不能访问另一个应用程序到我的文件”?
InputStream input=null;
OutputStream output=null;
HttpURLConnection connection=null;
try{
URL url=new URL(strings[0]);
connection= (HttpURLConnection) url.openConnection();
connection.connect();
int filelen=connection.getContentLength();
input=connection.getInputStream();
filechache();
output=new FileOutputStream(android.os.Environment.getExternalStorageDirectory()+"/nikandroid/"
+strings[1]+".mp3");
byte data[]=new byte[4096];
long total=0;
int count;
while((count=input.read(data))!=-1){
total+=count;
if (filelen>0) publishProgress((int)(total*100/filelen));
output.write(data,0,count);
}
}catch (Exception e){
e.printStackTrace();
}finally {
try{
if (output!=null) output.close();
if (input!=null) input.close();
}catch (IOException e){
e.printStackTrace();
}
if (connection!=null) connection.disconnect();
}
return null;
将其存储在应用程序的对象DB中,或者如果未使用,则隐藏文件。 – LenglBoy
您忘记了问题 – Zoe
将其保存在数据库中 – abcOfJavaAndCPP