Autore Topic: DropBox Error send File  (Letto 300 volte)

Offline C_G

  • Utente junior
  • **
  • Post: 69
  • Respect: 0
    • Mostra profilo
DropBox Error send File
« il: 19 Marzo 2014, 22:46:20 CET »
0
Ciao stò cercando di inviare il file database su DropBox ma ricevo questo errore:
Codice (Java): [Seleziona]
Caused by: java.lang.NullPointerException
03-19 22:44:35.059: E/AndroidRuntime(27033):    at main.Im.upload(Im.java:347)
la riga dell'errore:
Codice (Java): [Seleziona]
 com.dropbox.client2.DropboxAPI.Entry newEntry = mDBApi.putFile("Backup.db", inputStream,
                file.length(), null, null);

il metodo:
Codice (Java): [Seleziona]
public void upload(View v) {

    FileInputStream inputStream = null;
    try {
        File file =new File("/data/data/"+getPackageName()+"/databases/Backup.db");
        inputStream = new FileInputStream(file);
        com.dropbox.client2.DropboxAPI.Entry newEntry = mDBApi.putFile("Backup.db", inputStream,
                file.length(), null, null);
     //   Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
    } catch (DropboxUnlinkedException e) {
        // User has unlinked, ask them to link again here.
        Log.e("DbExampleLog", "User has unlinked.");
    } catch (DropboxException e) {
        Log.e("DbExampleLog", "Something went wrong while uploading.");
    } catch (FileNotFoundException e) {
        Log.e("DbExampleLog", "File not found.");
    } finally {
        if (inputStream != null) {
            try {
                inputStream.close();
            } catch (IOException e) {
            }
        }
    }