6

I want to capture a picture and upload it to Cloudinary directly. How can I know the name of the pic to set it at the upload statement cloudinary.uploader().upload("nameofthepic", Cloudinary.emptyMap());.

Here is my code:

public class Camera extends ActionBarActivity implements View.OnClickListener {
    Button b;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.camera);

        b= (Button) findViewById(R.id.button);
        b.setOnClickListener(this);

    }
    public static final int TAKE_PHOTO_REQUEST = 0;

    @Override
    public void onClick(View v) {
        Intent takePhotoIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(takePhotoIntent, TAKE_PHOTO_REQUEST);
        Map config = new HashMap();
        config.put("cloud_name", "dkepfkeuu");
        config.put("api_key", "552563677649679");
        config.put("api_secret", "7n8wJ42Hr_6nqZ4aOMDXjTIZ4P0");
        Cloudinary cloudinary = new Cloudinary(config);

        try {
            cloudinary.uploader().upload("", Cloudinary.emptyMap());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
James Davis
  • 474
  • 4
  • 10
Aya Radwan
  • 181
  • 5
  • 17
  • If the answer below worked for you, could you please accept it as the marked answer so that other users will have confidence that it works? – Martin Erlic Jan 20 '17 at 12:00

0 Answers0