Android Question Dropbox NullPointerExeption

Discussion in 'Android Questions' started by bus1963, Mar 29, 2015.

  1. bus1963

    bus1963 Member Licensed User

    Hi hardworking volunteers.

    Have a problem with my little program you want to download a Daten.csv in the dropbox.

    The error occurs during the execution of the -> manager.FileUpload - line
    Did the folder changed as well as the file itself ... does not help .. !!

    The error message:
    My Code:

    Code:
    #Region  Project Attributes
        
    #ApplicationLabel: SQPM
        
    #VersionCode: 1
        
    #VersionName:
        
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: unspecified
        
    #CanInstallToExternalStorage: False
    #End Region

    #Region  Activity Attributes
        
    #FullScreen: False
        
    #IncludeTitle: True
    #End Region

    Sub Process_Globals
        
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.
      
    Dim manager As DbxAccountManager  
    Dim key As String = "x9t0ymypxxxxx"
    Dim secret As String = "5xm9h1hdaxxxxxxx"

    End Sub

    Sub Globals
        
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.

        
    Private Button1 As Button

    End Sub

    Sub Activity_Create(FirstTime As Boolean)

            
    If FirstTime Then
                manager.Initialize(key, secret, 
    "manager" ,True)
              
    End If

            
    Activity.LoadLayout("Main")

    End Sub

    Sub Manager_AccountReady (Success As Boolean)
      
        
    If Success Then

            
    ToastMessageShow("Link to Dropbox successfull ...",False )

            manager.UploadFile(
    File.DirDefaultExternal,"Svenner.txt","/","Svenner.txt")
            
    Msgbox("Daten gesendet","UP OK")
          
        
    Else
      
             
    ToastMessageShow("Unable to Link to Dropbox  ...",False )
          
        
    End If

    End Sub

    Sub Button1_Click

        manager.LinkAccount

    End Sub
    My Manifest-Code:

    Here are the PMSQ file for testing:
    I sit now been 3 days in this problem and can not find the error.
    In advance thanks for the help.
     

    Attached Files:

    Last edited: Mar 29, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. bus1963

    bus1963 Member Licensed User

    Hi Erel and thank you for your answer.
    Now I have the right Lib (also need at initialization no longer Tru / False specify). ok!
    Now I have the problem that my Button1 shows no reaction.
    I think the manager.linkAccount has no function ... ?? !!
    Why this now ...?

    you can look again ..

    Thank-You
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Do you mean that Acccount_Ready is not raised?

    Make sure to check the logs, including the unfiltered logs.
     
  5. bus1963

    bus1963 Member Licensed User

    Hello again ...

    my app still does not work! ... unfortunately ...
    Could it be due to my phone? (HTC ONE M8)
    I changed the folder, the upload and the download tasted ... nothing works ...
    It is to despair ... always comes the error:

    java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.dropbox.sync.android.DbxFileSystem.exists(com.dropbox.sync.android.DbxPath)' on a null object reference

    Could it be because the some Orner exists / does not exist?
    Where the base folder of Dropbox is on the phone?
    "/" As path information is not enough ...
    can someone write the exact long path ... please me.

    Thank you again ..
     
  6. bus1963

    bus1963 Member Licensed User

    I have the latest Dropbox sync lib and latest android sdk dropbox loaded and inserted ......'m really despair at
     
  7. parijs

    parijs Active Member Licensed User

    Hi bus

    I have test your code

    I had to change two things

    manager.Initialize(key, secret, "manager" ,True)
    to
    manager.Initialize(key, secret, "manager")

    and

    manager.UploadFile(File.DirDefaultExternal,"Svenner.txt","/","Svenner.txt")
    to
    manager.UploadFile(File.DirRootExternal,"Svenner.txt","/","Svenner.txt")

    and it works

    the file was in the dir that I had given in dropbox
     
  8. bus1963

    bus1963 Member Licensed User

    Hello and thanks for the reply.
    Which sdk sync and what do you use?

    Libs I enabled the program: Core 4.01 and Dropbox sync 3.31
    I can not take away when initializing the boolean value
    then I get an error: too few arguments!
    The upload line I've changed to:

    Sub Manager_AccountReady (Success As Boolean)
    Log ("Account Ready" & Success)
    If Success Then
    manager.UploadFile (File.DirRootExternal, "Svenner.txt", "/", "Svenner.txt")
    End If
    End Sub

    It does not work !!
    I have been taking the folders in the phone have only one folder: android / data / com.dropbbox.android / and not com dropbox.sync.android

    Can there be the problem ..

    Please re for help
     
  9. bus1963

    bus1963 Member Licensed User

    and i have drop in the Lib Folder on B4A Program the: dropbox-sync-sdk-android 3.1.2

    My ideacounter is 0 :(
     
  10. bus1963

    bus1963 Member Licensed User

    I now have the Dropbox sync again changed to the version 3.00.
    The problem with the initialization line is now gone!

    Although now I get no error message, but the
    Sub Manager_AccountReady (Success As Boolean) is not executed.
    ... no error message - no uploading to Dropbox.

    What could now be even more flawed?

    Please suggestions ...
     
  11. parijs

    parijs Active Member Licensed User

    I use dropbox-sync-sdk-android 3.0.0
    Where is you Svenner.txt on your phone?
     
  12. bus1963

    bus1963 Member Licensed User

    Svenner.txt is in Folder:

    /sdcard/Svenner.txt
     
  13. bus1963

    bus1963 Member Licensed User

    I always thought would File.DirRootExternal = / sdcard /
     
  14. parijs

    parijs Active Member Licensed User

    can you drop it on your phone root and try
     
  15. parijs

    parijs Active Member Licensed User

    I have it on my card and on my phone not the same text and the Svenner.txt was comming from my phone
     
  16. bus1963

    bus1963 Member Licensed User

    I just tried it.
    When either is not writable or not enough disk space to copy
     
  17. bus1963

    bus1963 Member Licensed User

    How do I get the text file on my phone folder
     
  18. bus1963

    bus1963 Member Licensed User

    text file comes from the phone ... from which folder?
     
  19. parijs

    parijs Active Member Licensed User

    Have you copy Svenner.txt from your pc?
     
  20. parijs

    parijs Active Member Licensed User

    text file comes from the phone ... from which folder?

    the root
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice