简体   繁体   中英

android - upload pictures to dropbox

I am new to android programming. I am trying to upload pictures to dropbox, but I am getting java.lang.NullPointerException exception during the photo upload.

Here is my code snippet

try {
    FileInputStream fis = new FileInputStream(mFile);
    String path = mPath + mFile.getName();
    System.out.println("mFile is " + file);
    System.out.println("path is  " + path);
    System.out.println("fis is " + fis);
    mRequest = mdpi.putFileOverwriteRequest(path, fis, mFile.length(), null);
    if (mRequest != null) {
        mRequest.upload();

    }

The error is pointing me to this line mRequest = mdpi.putFileOverwriteRequest(path, fis, mFile.length(), null);

When i print out the variables which I am using in this line. I am getting the image path directory successfully, but don't know whats wrong.

您忘记声明mdpi并实例化它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM