Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Capture Image using device camera

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 296
    Comment on it

    This video tutorial describes how to capture an image using device camera.
    To captured an Image using device camera use to following code:-

    private static int REQ_CAMERA = 1001;
    
    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
         startActivityForResult(takePictureIntent, REQ_CAMERA);
     }
    

    To get the thumbnail of captured image override the onActivityResult() method of an activity class like this:-

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQ_CAMERA && resultCode == RESULT_OK) {
         Bundle extras = data.getExtras();
         Bitmap imageBitmap = (Bitmap) extras.get("data");
         // Now add this bitmap in the image view
        }
    }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: