ListView for ArrayList

0

I have Listview , a EditText and a Buttom . When I click the button I want it to play what it has in ListView to ArrayList , so I can insert what was written in EditText in ArrayList and then use it to load ListView .

In summary this would be:

ArrayList = ListView;
ArrayList.add(valor);
ListView.setAdapter(new ArrayAdapter(this, ..., ArrayList));

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal" >

    <ImageButton
        android:id="@+id/imgBtIncluirPessoaTarefa"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/edtPessoaEditarTarefa"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@android:drawable/ic_input_add" />

    <EditText
        android:id="@+id/edtPessoaEditarTarefa"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@id/imgBtIncluirPessoaTarefa"
        android:ems="10"
        android:hint="Pessoa"
        android:inputType="textPersonName" >

        <requestFocus />
    </EditText>
</RelativeLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <ListView
        android:id="@+id/listaPessoasEditar"
        android:layout_width="match_parent"
        android:layout_height="130sp" >
    </ListView>
</RelativeLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center_horizontal" >

    <ImageButton
        android:id="@+id/imgBtIncluirTarefa"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/edtTarefaEditarTarefa"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@android:drawable/ic_input_add" />

    <EditText
        android:id="@+id/edtTarefaEditarTarefa"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_toLeftOf="@id/imgBtIncluirTarefa"
        android:ems="10"
        android:hint="Tarefa"
        android:inputType="textPersonName" >
    </EditText>
</RelativeLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <ListView
        android:id="@+id/listaTarefasEditar"
        android:layout_width="match_parent"
        android:layout_height="130sp" >
    </ListView>
</RelativeLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <Button
        android:id="@+id/button1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Button" />
</RelativeLayout>

    
asked by anonymous 06.11.2014 / 00:46

0 answers