I have an app that capture image, show it and then send it to web server (with web service). The problem is that the image quality is very low (about 100px), and i can't find why is it happened.
Here is my code:
The button that open the camera:
cameraBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, CAMERA_REQUEST);
}
});
Show the image:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK) {
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
tmpImg.setImageBitmap(bitmap);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos);
byte[] imageInByte = baos.toByteArray();
dialog = ProgressDialog.show(MainActivity.this, "", "Uploading file...", true);
sendFile(imageInByte); // send the file to server
}
}
Any ideas?