1

在将文件保存到 SDCard 后,我想调用一个文件进行解析。对不起,我的英语不好。你能帮助我吗?从 Parse.com 将文件保存在外部存储中。这是我的代码:

 // 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();
            }
        });
4

0 回答 0