且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从Dropbox的下载文件并将其保存到SD卡

更新时间:2023-09-28 08:10:34

我找到了办法:

      File file= new File("/sdcard/New_csv_file.csv");
      OutputStream out= null;
      boolean result=false;
      try {
            out = new BufferedOutputStream(new FileOutputStream(file));
        } catch (FileNotFoundException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        try {
               DropboxFileInfo info = mApi.getFile("/photos/New_csv_file.csv", null, out, null);
               Log.i("DbExampleLog", "The file's rev is: " + info.getMetadata().rev);
               Intent JumpToParseCSV=new Intent(context,ParseCSV.class);
                JumpToParseCSV.putExtra("FileName", file.getAbsolutePath());
                Log.i("path", "FileName"+ file.getAbsolutePath());
                 ((Activity) context).finish();
                context.startActivity(JumpToParseCSV);
                result=true;
            } catch (DropboxException e) {
               Log.e("DbExampleLog", "Something went wrong while downloading.");
               file.delete();
               result=false;
            }


    return result;

感谢所有....

Thanks all....