start camera intent and save image in sdcard:
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == IMAGE_CAPTURE)
{
if (resultCode == RESULT_OK)
{
imageName = String.valueOf(System.currentTimeMillis()) + ".jpg";
}
}
}
public void startCamera()
{
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
imageName = "newImage"+String.valueOf(System.currentTimeMillis()) + ".jpg";
File file = new File(Environment.getExternalStorageDirectory().getPath(), “/images/" +imageName);
imageUri = Uri.fromFile(file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
startActivityForResult(intent, IMAGE_CAPTURE);
}
No comments:
Post a Comment