Android Question Dropbox Upload File

madSac

Active Member
Licensed User
Longtime User
Hi,
I was trying to upload a file using dropbox Sync Api but was not able Got some nullpoinyter exception.

Can anyone give me sample code on how to upload a file using api from anypath( external,internal any)

Thank you
 
Export your project and upload it here. Put comments in code to mark places in code you have problems with.
This is a community forum. We want to help LEARNING B4A, not writing the code for you.
Have you searched the forum for possible exmples?

Maybe you describe more in detail what exactly you want to do and which code you are using (export project as zip).
 
Upvote 0
this is a stripped down version of a personal app that works for me .. It might be useful ..
a database file is updated then uploaded. The project will not run but the code could be helpful.
 

Attachments

Upvote 0
@DonManfred Well the question doesnot needed any code but if you want i have added my code
Code: Copy
      Private manager As DbxAccountManager
    'Dropbox Initalization
      Private DropboxKey As String = "myKey"
      Private DropboxSecret As String = "mySecret"
      manager.Initialize(DropboxKey, DropboxSecret, "manager")
      manager.UploadFile(File.DirDefaultExternal & "/testfolder/",".nomedia","/",".nomedia")

@mangojack does this uploads file ?
Code: Copy
      manager.UploadFile(File.DirDefaultExternal,"Data.db", "/", "Data.db")
 
Upvote 0
i am getting following error

Code: Copy
Error occurred on line: 63 (myapp)
java.lang.NullPointerException
    at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.getFile(DbxAccountManagerWrapper.java:147)
    at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.UploadFile(DbxAccountManagerWrapper.java:161)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:519)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:235)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
    at com.mycom.myapp.myapp.handleStart(myapp.java:68)
    at com.mycom.myapp.myapp.onStartCommand(myapp.java:53)
    at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2833)
    at android.app.ActivityThread.access$2000(ActivityThread.java:159)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1419)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5419)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:525)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1187)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    at dalvik.system.NativeStart.main(Native Method)
 
Upvote 0
@mangojack does this uploads file ?
Code:
manager.UploadFile(File.DirDefaultExternal,"Data.db", "/", "Data.db")
Yes ..

Have you tried to place dummy db or txt file directly to DefaultExternal dir to test above code... eliminating possibility that '.nomedia ' is the cause ?
I am no expert in this but I thought any folder/file with ' . ' at the start was hidden to android .
 
Upvote 0
Ok..
I will try uploading a text file.But i don't think that .nomedia is the issue.It is just an way to identify systemfiles.
here is new code.
Code: Copy
manager.UploadFile(file.DirRootExternal,"test.png","/","test.png")

I am still getting the same error
 
Upvote 0
Back
Top