We set a imageView in the the android xml layout
and a button to capture image
In the onclick of the button we
Set uo an Intent to capture image
and a button to capture image
In the onclick of the button we
Set uo an Intent to capture image
Intent intent= new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
after the we start activity of this Intent
startActivityForResult(intent,0);but it must be noticed that its not just startActivity but StartActivity for Resultwhich mean that we will be able to capure the resultTo Capture the result we will have to override a method called onActivityResultWe will recieve our image in bitmap format and for that we will create a bitmap objectWe also create a global ImageView variable in our class and initialize that while we are inOncreatein the onActivityresultwe put this codeBitmap bm= (Bitmap) data.getExtras().get("data");// gets the image of the result iv.setImageBitmap(bm);
No comments:
Post a Comment