3

i have a camera Activity after which i take a picture and saving it to gallery and uploading to the server My upload code is not working, i need help on this?

// image capture

Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); startActivityForResult(intent, 0); 

//image Saving

if(requestCode==0&&resultCode==RESULT_OK) { Bundle extras = data.getExtras(); Bitmap b = (Bitmap) extras.get("data"); ImageView mImg; mImg = (ImageView) findViewById(R.id.head); mImg.setImageBitmap(b); // save image to gallery Shot = "HeadShot"; //Long.toString(System.currentTimeMillis()); MediaStore.Images.Media.insertImage(getContentResolver(), b, Shot, NAME); } 

//Upload to the server

public void Upload(String url, HttpEntity imgdata) throws Exception, Exception { DefaultHttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost(url); post.setHeader("Content-Type", "bitmap; charset=utf-8"); post.setURI(new URI(url)); post.setEntity(imgdata); HttpUriRequest request = post; HttpResponse response = client.execute(request); HttpEntity entity = response.getEntity(); return entity.getContent(); } 
0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.