Autore Topic: Download file from..  (Letto 349 volte)

Offline C_G

  • Utente junior
  • **
  • Post: 69
  • Respect: 0
    • Mostra profilo
Download file from..
« il: 22 Marzo 2014, 22:57:55 CET »
0
Stò utilizzando la libreria aChooseFile (iPaulPro) per scaricare sul dispositivo un file da internet (DropBox, SkyDrive, GoogleDrive ecc..)
Funziona tutto tranne quando scarico il file da GoogleDrive e ottengo questo errore:
Codice (Java): [Seleziona]
03-22 22:55:18.098: W/System.err(10130): java.io.FileNotFoundException: /document/acc=3;doc=13041: open failed: ENOENT (No such file or directory)
03-22 22:55:18.108: W/System.err(10130):        at libcore.io.IoBridge.open(IoBridge.java:409)
03-22 22:55:18.108: W/System.err(10130):        at java.io.FileInputStream.<init>(FileInputStream.java:78)
03-22 22:55:18.108: W/System.err(10130):        at main.FileUtils.copyFile(FileUtils.java:16)
03-22 22:55:18.108: W/System.err(10130):        at main.Impostazioni.importDB(Impostazioni.java:396)
03-22 22:55:18.108: W/System.err(10130):        at main.Impostazioni.onActivityResult(Impostazioni.java:416)
03-22 22:55:18.108: W/System.err(10130):        at android.app.Activity.dispatchActivityResult(Activity.java:5618)
03-22 22:55:18.108: W/System.err(10130):        at android.app.ActivityThread.deliverResults(ActivityThread.java:3547)
03-22 22:55:18.108: W/System.err(10130):        at android.app.ActivityThread.handleSendResult(ActivityThread.java:3594)
03-22 22:55:18.108: W/System.err(10130):        at android.app.ActivityThread.access$1400(ActivityThread.java:161)
03-22 22:55:18.108: W/System.err(10130):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1313)
03-22 22:55:18.108: W/System.err(10130):        at android.os.Handler.dispatchMessage(Handler.java:102)
03-22 22:55:18.108: W/System.err(10130):        at android.os.Looper.loop(Looper.java:157)
03-22 22:55:18.108: W/System.err(10130):        at android.app.ActivityThread.main(ActivityThread.java:5356)
03-22 22:55:18.108: W/System.err(10130):        at java.lang.reflect.Method.invokeNative(Native Method)
03-22 22:55:18.108: W/System.err(10130):        at java.lang.reflect.Method.invoke(Method.java:515)
03-22 22:55:18.108: W/System.err(10130):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
03-22 22:55:18.108: W/System.err(10130):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
03-22 22:55:18.108: W/System.err(10130):        at dalvik.system.NativeStart.main(Native Method)
03-22 22:55:18.108: W/System.err(10130): Caused by: libcore.io.ErrnoException: open failed: ENOENT (No such file or directory)
03-22 22:55:18.108: W/System.err(10130):        at libcore.io.Posix.open(Native Method)
03-22 22:55:18.108: W/System.err(10130):        at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
03-22 22:55:18.108: W/System.err(10130):        at libcore.io.IoBridge.open(IoBridge.java:393)
03-22 22:55:18.108: W/System.err(10130):        ... 17 more

questo è il metodo per importare:
Codice (Java): [Seleziona]
private void importDB(File from){
       
        File to = new File("/data/data/"+getPackageName()+"/databases/Backup.db");     
       
        try {
                FileUtils.copyFile(from, to);
                Toast.makeText(this, getString(R.string.Toast_import) , Toast.LENGTH_SHORT).show();
               
        } catch (IOException e) {
                e.printStackTrace();
                Toast.makeText(this, "Error" , Toast.LENGTH_SHORT).show();
        }
       
}
forse googledrive non riconosce il percorso??
Grazie