1

I want call one file to parse, after I save the file to the SDCard. I'm sorry, my English is not good. Can you help me? Save file in external storage from Parse.com. This is my code:

 // Capture button clicks
        btnUpload.setOnClickListener(new View.OnClickListener() {

            public void onClick(View arg0) {
                // Locate the image in res > drawable-hdpi

                for (int i = 0; i < mangImage.length; i++) {
                    InputStream in = getResources().openRawResource(mangImage[i]);
                    try {

                        ParseObject imgupload = new ParseObject("Map");
                        byte[] data = getBytesFromInputStream(in);
                        String nameFile = getResources().getResourceEntryName(mangImage[i])+".tmx";
                        ParseFile file = new ParseFile(nameFile,
                                                       data);
//                    byte[] image = stream.toByteArray();
//                    ParseFile file = new ParseFile("" + mangImage[i] + ".tmx", image);
                        file.saveInBackground();

                        // Create a column named "ImageName" and set the string

                        imgupload.put("nameMap",
                                      "" +nameFile);

                        // Create a column named "ImageFile" and insert the image
                        imgupload.put("fileMap", file);

                        // Create the class and the columns
                        imgupload.saveInBackground();

                    } catch (IOException e) {
                        e.printStackTrace();
                    }

                }

                Toast.makeText(UploadActivity.this,
                               "Image Uploaded",
                               Toast.LENGTH_SHORT)
                     .show();
            }
        });
Will
  • 24,082
  • 14
  • 97
  • 108
Nhu Van
  • 111
  • 8
  • 1
    possible duplicate of [How to save file to sd card](http://stackoverflow.com/questions/6674249/how-to-save-file-to-sd-card) – TDG Jul 10 '15 at 07:39
  • i want call parse after save file – Nhu Van Jul 10 '15 at 07:41
  • I think you can get something from here---> http://www.coderzheaven.com/2012/01/29/saving-textfile-to-sdcard-in-android/ https://sites.google.com/site/androidhowto/how-to-1/save-file-to-sd-card http://www.java-samples.com/showtutorial.php?tutorialid=1523 – Chaudhary Amar Jul 10 '15 at 07:42

0 Answers0