문제

I'm fighting with dropbox sync SDK (Android) to upload some images to my dropbox private Aplication folder, the problem is when I have a FileInputStream dont know what method need to use for upload

this is a portion of the code:

uploadImg=(ImageView) mView.findViewById(R.id.uploadi);   
        uploadImg.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {

            if (mDbxAcctMgr.hasLinkedAccount()) {
                try {
                    DbxFileSystem dbxFs = DbxFileSystem.forAccount(mDbxAcctMgr.getLinkedAccount());
                    DbxPath testPath = new DbxPath(DbxPath.ROOT, items.get(position));

                    if (!dbxFs.exists(testPath)) {
                        dbxFs.createFolder(testPath);
                        getData(ids.get(position));
                        int cont = 0;

                        for(int i=0; i<f.size(); i++){
                            File tmpFile;
                            FileInputStream fis;    
                            tmpFile = new File(f.get(i), cont+".jpg");
                            cont++;
                            fis = new FileInputStream(tmpFile);
                            DbxPath filePath = new DbxPath(testPath, items.get(position)); 
//CODE TO UPLOAD FILE

                        }
                    }

                } catch (Unauthorized e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (DbxException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

            } 
            else { } //!haslinked

            }

        });

I've searched in

link1

and here

link2

but the info not be intuitive for upload files from existing file.

Also I've founded this and this but needs to create a private DropboxAPI<AndroidAuthSession> mDBApi and when I try to define eclipse show me a error. "DropboxAPI cannot be resolved to a type"

Somebody can I help me? Thanks a lot

도움이 되었습니까?

해결책

You should use the writeFromExistingFile method in the Sync SDK to write an existing local file into Dropbox. (The last two links you have are for the Core SDK, which is entirely different.)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top