Uploading and saving a video using the Parse API on Android was unsuccessful

- I use Parseapi to upload and save the video file on the server Parse.comfor the application.

. I am currently using the following code from the Parse Documentation to upload a video file to Parse Server:

    File f = new File("/sdcard/video-2013-02-21-13-03-24.mp4");

    byte[] videoUp = IOUtils.toByteArray( new FileInputStream(f));


    ParseFile file = new ParseFile("testVideo1", videoUp);




    file.saveInBackground(new SaveCallback() {


        public void done(ParseException e) {

      e.printStackTrace();

     }

     }, new ProgressCallback() {

     public void done(Integer percentDone) {

     System.out.println("Progress :" + percentDone);
      }
     });

- In the first , 100% printing is performed , which is the result of the operator System.out.printlnfrom method done()c Integeras a parameter, and immediately after that it goes to method done()c ParseExceptionas a parameter printing the next stack trace.

FATAL EXCEPTION: main
java.lang.NullPointerException
at com.example.uploadfileusingparse.MainActivity$1$1.done(MainActivity.java:63)
at com.parse.SaveCallback.internalDone(SaveCallback.java:42)
at com.parse.SaveCallback.internalDone(SaveCallback.java:29)
at com.parse.BackgroundTask.onPostExecute(BackgroundTask.java:50)
at com.parse.BackgroundTask.onPostExecute(BackgroundTask.java:16)
at android.os.AsyncTask.finish(AsyncTask.java:417)
at android.os.AsyncTask.access$300(AsyncTask.java:127)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4633)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)

- Parse IPhone, , Android.

- - , Parse Api .

+5
1

, . saveInBackground() , ParseException done (ParseException e) null. , , ParseException null:

  public void done(ParseException e) {
      if(e==null) {
          // SUCCESS!!!
      } else {
          e.printStackTrace();
      }
  }

ParseObject , * inBackground

0

All Articles