Siva K
Siva K

Reputation: 4968

how to upload image captured from camera in an android app

in my app i have placed a button called Add Photo, when the user clicks the button a pop up menu appears with 2 option camera and library. When i select library i am able to move to the photo album of the device. Following is the code which i am using to go to the mobile library

public void library() { Intent myIntent = new Intent(Intent.ACTION_PICK); myIntent.setType("image/*"); startActivityForResult(myIntent, 1); }

whatever image i click there i want it to be uploaded in an url,

in the same way the image which i capture through the camera also want to be uploaded in an url.

how to do this is there any API or example code pls help me

Upvotes: 7

Views: 10018

Answers (1)

Jim Blackler
Jim Blackler

Reputation: 23179

This SO answer explains how to get the true path of the image in your onActivityResult

How to pick an image from gallery (SD Card) for my app?

Then look for an example on how to upload a file using http, any Java example ought to work, for instance:

http://www.jguru.com/faq/view.jsp?EID=62798

Upvotes: 5

Related Questions