0

I have a simple form that ask for firstname , name and email. I would like to have a field where I can attach an image from the phone's galerie like when you send a picture through message (http://img11.hostingpics.net/pics/663614clip128.png) . Is it possible to do it ?

Here is my xml for the simple form :

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">


<LinearLayout

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:layout_alignParentBottom="true"

    android:layout_alignParentLeft="true"

    android:layout_alignParentRight="true"

    android:layout_alignParentTop="true"

    android:orientation="vertical" >



    <TextView

        android:id="@+id/textView1"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="25dp"
        android:layout_marginTop="25dp"

        android:text="@string/m_informations"

        android:textAppearance="?android:attr/textAppearanceLarge" />



    <TextView

        android:id="@+id/textView2"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"

        android:text="@string/FirstName"

        android:textAppearance="?android:attr/textAppearanceMedium" />



    <EditText

        android:id="@+id/editText1"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:ems="10"

        android:inputType="textPersonName" >



        <requestFocus />

    </EditText>



    <TextView

        android:id="@+id/textView3"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"

        android:text="@string/Name"

        android:textAppearance="?android:attr/textAppearanceMedium" />



    <EditText

        android:id="@+id/editText2"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:ems="10"

        android:inputType="textPersonName" />



    <TextView

        android:id="@+id/textView4"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"

        android:text="@string/Email"

        android:textAppearance="?android:attr/textAppearanceMedium" />



    <EditText

        android:id="@+id/editText3"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:ems="10"

        android:inputType="textEmailAddress" />



    <Button

        android:id="@+id/button1"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="center_horizontal"

        android:text="@string/confirm" />

</LinearLayout>

Bob
  • 111
  • 2
  • 9
  • All is possible. You should of course add an ImageView to your layout where you can display the image. – greenapps Feb 11 '15 at 20:17
  • Can you provide a tutorial ? Because I don't really know how to do it.. – Bob Feb 11 '15 at 20:25
  • Thank you but you don't tell how can I go and pick a picture in my phone.. – Bob Feb 11 '15 at 20:42
  • 1
    This question has already been answered - http://stackoverflow.com/questions/2169649/get-pick-an-image-from-androids-built-in-gallery-app-programmatically – Dave S Feb 11 '15 at 21:25

0 Answers0