Skip to content

Instantly share code, notes, and snippets.

@pacificregmi
Created December 18, 2015 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pacificregmi/f1aaf5dc0ebd8f49e134 to your computer and use it in GitHub Desktop.
Save pacificregmi/f1aaf5dc0ebd8f49e134 to your computer and use it in GitHub Desktop.
How to Capture Image from Android Camera and Display it Programmatically - capture_image_from_camera_and_display.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:gravity="center_horizontal"
android:layout_margin="16dp"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click the below button to take photo from camera and display it in image view"/>
<Button
android:id="@+id/take_image_from_camera"
android:layout_width="wrap_content"
android:layout_marginTop="10dp"
android:onClick="takeImageFromCamera"
android:layout_height="wrap_content"
android:text="Take Photo From Camera"/>
<ImageView
android:id="@+id/image_from_camera"
android:layout_width="200dp"
android:src="@drawable/image"
android:layout_height="300dp"
android:layout_marginTop="16dp"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="ViralAndroid.com"
android:autoLink="web"
android:textSize="24sp"
android:textStyle="bold"
android:gravity="center|bottom"/>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment