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 in Others by nisha
• 2,160 points
6 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 by polo
• 1,500 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 in Others by Rahul
• 8,980 points
15 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 in Others by nisha
• 2,160 points
16 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 in Others by gaurav
• 13,460 points
25 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 in Others by nisha
• 2,160 points
10 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
2,956 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,080 points
1,511 views
0 votes
1 answer

Is there a way to run Python on Android?

YES! An example via Matt Cutts via SL4A -- "here’s ...READ MORE

answered Sep 19, 2018 in Python by Priyaj
• 58,080 points
389 views
0 votes
1 answer

How can we get the current location in Android?

First you need to define a LocationListener to handle ...READ MORE

answered Sep 25, 2018 in Java by Parth
• 4,630 points
370 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 in Others by polo
• 1,500 points
16 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 in Others by polo
• 1,500 points
14 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP