Getting pictures from albums is one of the most used technologies in Android apps, but it's easy to use intent.
Just knocked on a dome before going to bed or sharing a bit
1 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"2 Xmlns:tools= "Http://schemas.android.com/tools"3 Android:layout_width= "Match_parent"4 Android:layout_height= "Match_parent"5 android:orientation= "vertical">6 7 8 <Button9 Android:layout_width= "Fill_parent"Ten Android:layout_height= "Wrap_content" One Android:text= "View" A Android:onclick= "Take" /> - <ImageView - Android:id= "@+id/im" the Android:layout_width= "Fill_parent" - Android:layout_height= "Fill_parent" /> - - </LinearLayout>
The main view of Java code
Open the camera picture public void take (View v) {Intent Intent = new Intent (); intent.setaction (Intent.action_pick); Intent.settype (" Vnd.android.cursor.dir/image "); Startactivityforresult (intent, 200);} @Overrideprotected void Onactivityresult (int requestcode, int resultcode, Intent data) {Super.onactivityresult ( Requestcode, ResultCode, data); try {uri uri = Data.getdata (); Bitmap Bitmap = MediaStore.Images.Media.getBitmap (Getcontentresolver (), URI); Im.setimagebitmap (Bitmap);// Set to ImageView} catch (Exception e) {e.printstacktrace ();}}
And here's the next possible permission to
<uses-permission android:name= "Android.permission.CAMERA"/>
Android Get pictures from albums