How to select Image from Camera or Gallery with Intent in Android Java
Hey there, In this article, I will share the complete code and step-by-step process to show you how you can upload or select Images from an Android device by clicking photo directly using a camera or selecting an image from Gallery. Also, Pass Image data to the next activity or Page.
In This android application I have created to screens:
- MainActivity : 3 buttons and 1 Image view
- Page2Activity : 1 ImageView
Step 1: Add these Lines to your Manifest.xml File
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera"
android:required="true" />
Step 2 : Layout Design
- activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:context=".MainActivity">
<ImageView
android:id="@+id/imageview"
android:layout_width="200dp"…