Categories
Android

Android adding camera in app

So why not use the camera that already exists in your Android Phone!

First put the following in AndroidManifest.xml before the <application…></application> tag

<uses-feature android:name="android.hardware.camera" />

Then go to the MainActivity class or wherever you want to call “Camera opening function”. Add the following function:

public void startCamera(View view){ Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivity(takePictureIntent); }
  1. Here, startCamera is a function called when a button is pressed.
  2. The default camera app of your phone opens and you will have all the advanced features without any work.
  3. Done 😀