0

私は1つのAndroidアプリケーションを完成させ、データベースをアップロードするためにDropBoxをアプリケーションに統合しました.単一のファイルをアップロードすると、正しくアップロードされます.例外が見つかりません。私もこのリンクを使用していますが、解決策がありません。 リンク

FileInputStream inputStream = null;
             try {
                 String databasePath=getDatabasePath("databaseTaskApps.db").getPath();
                 Log.i(TAG,"DatabasePath:"+databasePath);
                 File file = new File(databasePath+ "/databaseTaskApps");
                 inputStream = new FileInputStream(file);

                 com.dropbox.client2.DropboxAPI.Entry newEntry = mApi.putFileOverwrite("/databaseTaskApps", inputStream,
                         file.length(), null);
                 Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
             } catch (DropboxUnlinkedException e) {
                 // User has unlinked, ask them to link again here.
                 Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
             } catch (DropboxException e) {
                 Log.e("DbExampleLog", "Something went wrong while uploading.");
                 Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
             } catch (FileNotFoundException e) {
                 Log.e("DbExampleLog", "File not found.");
                 Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
             } finally {
                 if (inputStream != null) {
                     try {
                         inputStream.close();
                     } catch (IOException e) {
                     }
                 }
             }
4

1 に答える 1

0

ハイ、私の質問に対する答えを見つけました

File[] files = new File("/data/data/com.dropbox.android.sample/databases/").listFiles(); 
            for (File f:files) {

                if (f.getName().equals("databaseTaskApps"))
                {
                    FileInputStream inputStream = null;
                    try {
                        inputStream = new FileInputStream(f);

                        com.dropbox.client2.DropboxAPI.Entry newEntry = mApi.putFileOverwrite("/databaseTaskApps", inputStream,
                                f.length(), null);
                        Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev);
                    } catch (DropboxUnlinkedException e) {
                        // User has unlinked, ask them to link again here.
                     Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
                    } catch (DropboxException e) {
                        Log.e("DbExampleLog", "Something went wrong while uploading.");
                        Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
                    } catch (FileNotFoundException e) {
                        Log.e("DbExampleLog", "File not found.");
                        Toast.makeText(getApplicationContext(), "Not Uploading", Toast.LENGTH_SHORT).show();
                    } finally {
                        if (inputStream != null) {
                            try {
                                inputStream.close();
                            } catch (IOException e) {
                            }
                        }
                    }

                }
            } 
于 2013-09-17T06:37:04.673 に答える