Below is my code
m_oTakePicture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
m_oIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(m_oIntent, CAMERA_REQUEST);
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
m_oTakenPicture = (Bitmap) data.getExtras().get("data");
m_oProductImage.setImageBitmap(m_oTakenPicture);
File pictureFile = getOutputMediaFile();
if (pictureFile == null) {
return;
}
try {
m_oFIleoutputStream = new FileOutputStream(pictureFile);
m_oTakenPicture.compress(Bitmap.CompressFormat.JPEG, 100, m_oFIleoutputStream);
m_sImageString = mediaStorageDir.getPath() + "/image.PNG";
m_oFIleoutputStream.flush();
m_oFIleoutputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static File getOutputMediaFile() {
//make a new file directory inside the "sdcard" folder
mediaStorageDir = new File("/sdcard/", "PayRu");
//if this "JCGCamera folder does not exist
if (!mediaStorageDir.exists()) {
//if you cannot make this folder return
if (!mediaStorageDir.mkdirs()) {
return null;
}
}
//take the current timeStamp
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
File mediaFile;
//and make a media file:
sFilename= "/image.PNG";
mediaFile = new File(mediaStorageDir.getPath() + File.separator +sFilename);
return mediaFile;
}
later i am passing my imagepath as string to upload
oProduct.setImageFile(m_sImageString);
My problem is using this code i can able to upload image but i want good quality image
m_oTakePicture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
m_oIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(m_oIntent, CAMERA_REQUEST);
}
});
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == CAMERA_REQUEST && resultCode == RESULT_OK) {
m_oTakenPicture = (Bitmap) data.getExtras().get("data");
m_oProductImage.setImageBitmap(m_oTakenPicture);
File pictureFile = getOutputMediaFile();
if (pictureFile == null) {
return;
}
try {
m_oFIleoutputStream = new FileOutputStream(pictureFile);
m_oTakenPicture.compress(Bitmap.CompressFormat.JPEG, 100, m_oFIleoutputStream);
m_sImageString = mediaStorageDir.getPath() + "/image.PNG";
m_oFIleoutputStream.flush();
m_oFIleoutputStream.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static File getOutputMediaFile() {
//make a new file directory inside the "sdcard" folder
mediaStorageDir = new File("/sdcard/", "PayRu");
//if this "JCGCamera folder does not exist
if (!mediaStorageDir.exists()) {
//if you cannot make this folder return
if (!mediaStorageDir.mkdirs()) {
return null;
}
}
//take the current timeStamp
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
File mediaFile;
//and make a media file:
sFilename= "/image.PNG";
mediaFile = new File(mediaStorageDir.getPath() + File.separator +sFilename);
return mediaFile;
}
later i am passing my imagepath as string to upload
oProduct.setImageFile(m_sImageString);
My problem is using this code i can able to upload image but i want good quality image