Android open camera from button

0 votes

How do I got about doing that? I know there is a function:

intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE)

Do I need to use that? And how do I call the button from the xml file?

Jun 14, 2022 in Others by nisha
• 2,210 points
1,540 views

1 answer to this question.

0 votes

you can use the below syntax as it worked with me just fine

Camera=(Button)findViewById(R.id.CameraID);
Camera.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Intent Intent3=new   Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
            startActivity(Intent3); 
        }
    });
answered Jun 14, 2022 by polo
• 1,480 points

Related Questions In Others

0 votes
1 answer

How to open the Google Play Store directly from my Android application?

By using developer.andriod.com, one can solve this ...READ MORE

answered Feb 8, 2022 in Others by Rahul
• 9,680 points
864 views
0 votes
1 answer

How to open the Google Play Store directly from my Android application?

To open Google Play AND ONLY Google ...READ MORE

answered Jun 6, 2022 in Others by nisha
• 2,210 points
1,976 views
0 votes
1 answer

How to open .xlsx files in MS Excel from VS Code?

Hello, to open xlxs files, or files ...READ MORE

answered Feb 17, 2022 in Others by gaurav
• 23,260 points
4,157 views
0 votes
1 answer

Open Instagram user profile on android

To open instagram app- String scheme = "http://instagram.com/_u/USER"; String path ...READ MORE

answered May 31, 2022 in Others by nisha
• 2,210 points
2,133 views
0 votes
1 answer

How to turn on front flash light programmatically in Android?

For this problem you should: Check whether the ...READ MORE

answered Nov 8, 2022 in Android by Edureka
• 12,690 points
1,617 views
0 votes
0 answers

Use camera flashlight in Android

I'm trying to use the cameras LED ...READ MORE

Nov 23, 2022 in Android by Ashwini
• 5,430 points
1,048 views
0 votes
1 answer

Running docker on Android

According to the documentation, the Android kernel is ...READ MORE

answered Aug 1, 2018 in Docker by Kalgi
• 52,350 points
3,771 views
0 votes
1 answer

Task Canceled Exception while invoking AWS Lambda

I'm guessing either the TaskCanceledException instance is ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 58,020 points
2,469 views
0 votes
1 answer

How can I open a URL in Android's web browser from my application?

ry this: Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri ...READ MORE

answered Jun 14, 2022 in Others by polo
• 1,480 points
4,804 views
0 votes
1 answer

extract audio in MP3 format from video in android

Use FFMPEG for android U need to implement a ...READ MORE

answered Jun 16, 2022 in Others by polo
• 1,480 points
1,863 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP