how to retrieve string value from dynamic edit text..?
<p>In my layout I added two edit text by click on the add button and its added(works) and when I click on delete button it also delete the dynamic edit text.My question is how to get string value from it suppose I dynamically add two views and also delete when not needed.
here is my code..</p>

<pre><code>public class PartDetails extends AppCompatActivity {

    // Parent view for all rows and the add button.
    private LinearLayout mContainerView;
    // The "Add new" imageButton
    private ImageButton mAddImageButton;
    Button submit_part_details;
    private View mExclusiveEmptyView;
    EditText prequired,pnumber;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_part_details);

        mContainerView = (LinearLayout) findViewById(R.id.parentView);
        submit_part_details = (Button) findViewById(R.id.submit_part_details);
        mAddImageButton = (ImageButton) findViewById(R.id.add_et_parts);
        prequired= (EditText) findViewById(R.id.et_Prequired);
        pnumber= (EditText) findViewById(R.id.et_Pnumber);
        mAddImageButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                inflateEditRow();
            }
        });
        submit_part_details.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String parts=prequired.getText().toString();
                String pnum =pnumber.getText().toString();
            }
        });
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        // TODO: Handle screen rotation:
        // encapsulate information in a parcelable object, and save it
        // into the state bundle.

    }
    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        // TODO: Handle screen rotation:
        // restore the saved items and inflate each one with inflateEditRow;

    }

    // Helper for inflating a row
    private void inflateEditRow() {

        LayoutInflater layoutInflater =
                (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        final View addView = layoutInflater.inflate(R.layout.row_add_parts, null);
        final EditText parts_required = (EditText) addView
                .findViewById(R.id.et_parts);
        final EditText parts_number = (EditText) addView
                .findViewById(R.id.et_Pnumber);
        final ImageButton deleteButton = (ImageButton) addView
                .findViewById(R.id.delete_et_parts);
        deleteButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                ((LinearLayout) addView.getParent()).removeView(addView);
            }
        });

        mContainerView.addView(addView);
    }
}
</code></pre>

<p>this is parent XML layout</p>

<pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;

    &lt;ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true"&gt;

        &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:background="@android:color/black"
            android:layout_height="match_parent"
            android:focusableInTouchMode="true"&gt;


            &lt;LinearLayout
                android:id="@+id/parentView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:animateLayoutChanges="true"
                android:layout_below="@+id/tv"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:orientation="vertical"&gt;

                &lt;RelativeLayout
                    android:id="@+id/relative_layout1"
                    android:layout_marginTop="10dp"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"&gt;

                    &lt;TextView
                        android:id="@+id/parts_required"
                        android:layout_width="110dp"
                        android:layout_height="40dp"
                        android:text="Parts Required"
                        android:textColor="#fff"
                        android:textSize="15sp"
                        android:textStyle="bold"
                        android:background="@drawable/shape"
                        android:gravity="center"/&gt;

                    &lt;LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@+id/parts_required"
                        android:layout_marginLeft="20dp"
                        android:orientation="horizontal"&gt;

                        &lt;EditText
                            android:id="@+id/et_Prequired"
                            android:layout_width="0dp"
                            android:layout_height="40dp"
                            android:layout_weight="0.8"
                            android:hint="text"
                            android:singleLine="true"
                            android:inputType="text"
                            android:textSize="20sp"
                            android:paddingLeft="20dp"
                            android:imeOptions="actionNext"
                            android:background="@drawable/shape_edit_text"
                            /&gt;

                        &lt;ImageButton
                            android:id="@+id/add_et_parts"
                            android:layout_width="0dp"
                            android:layout_height="40dp"
                            android:background="@null"
                            android:onClick="onAddNewClicked"
                            android:src="@android:drawable/ic_input_add"
                            android:layout_weight="0.2"/&gt;


                    &lt;/LinearLayout&gt;


                &lt;/RelativeLayout&gt;
&lt;RelativeLayout
                android:id="@+id/relative_layout2"
                android:layout_marginTop="5dp"
                android:layout_below="@+id/relative_layout1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"&gt;

                &lt;TextView
                    android:id="@+id/parts_number"
                    android:layout_width="110dp"
                    android:layout_height="40dp"
                    android:text="Parts Number"
                    android:textColor="#fff"
                    android:textSize="15sp"
                    android:textStyle="bold"
                    android:background="@drawable/shape"
                    android:gravity="center"/&gt;

                &lt;LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_toRightOf="@+id/parts_number"
                    android:layout_marginLeft="20dp"
                    android:orientation="horizontal"&gt;

                    &lt;EditText
                        android:id="@+id/et_Pnumber"
                        android:layout_width="0dp"
                        android:layout_height="40dp"
                        android:layout_weight="1"
                        android:hint="text"
                        android:singleLine="true"
                        android:inputType="text"
                        android:textSize="20sp"
                        android:paddingLeft="20dp"
                        android:imeOptions="actionNext"
                        android:background="@drawable/shape_edit_text"
                        /&gt;

                    &lt;!-- &lt;ImageButton
                         android:id="@+id/add_et_parts_number"
                         android:layout_width="0dp"
                         android:layout_height="50dp"
                         android:background="@null"
                         android:src="@android:drawable/ic_input_add"
                         android:layout_weight="0.2"/&gt;--&gt;

                &lt;/LinearLayout&gt;

            &lt;/RelativeLayout&gt;


                &lt;Button
                    android:layout_marginTop="50dp"
                    android:id="@+id/submit_part_details"
                    android:layout_width="match_parent"
                    android:layout_height="40dp"
                    android:layout_below="@+id/snap"
                    android:textAllCaps="false"
                    android:textSize="20sp"
                    android:textColor="#fff"
                    android:background="#1c4648"
                    android:text="Submit All Details" /&gt;

            &lt;/RelativeLayout&gt;



        &lt;/RelativeLayout&gt;
    &lt;/ScrollView&gt; 
</code></pre>

<p>this is Add Button XML layout</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:background="@android:color/black"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"&gt;

    &lt;RelativeLayout
        android:id="@+id/relative_layout1"
        android:layout_marginTop="10dp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"&gt;

        &lt;TextView
            android:id="@+id/parts_required"
            android:layout_width="110dp"
            android:layout_height="40dp"
            android:text="Parts Required"
            android:textColor="#fff"
            android:textSize="15sp"
            android:textStyle="bold"
            android:background="@drawable/shape"
            android:gravity="center"/&gt;

        &lt;LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/parts_required"
            android:layout_marginLeft="20dp"
            android:orientation="horizontal"&gt;

            &lt;EditText
                android:id="@+id/et_parts"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="0.8"
                android:singleLine="true"
                android:inputType="text"
                android:textSize="20sp"
                android:hint="text"
                android:paddingLeft="20dp"
                android:imeOptions="actionNext"
                android:background="@drawable/shape_edit_text"
                /&gt;

            &lt;ImageButton
                android:id="@+id/delete_et_parts"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:background="@null"
                android:src="@android:drawable/ic_delete"
                android:layout_weight="0.2"/&gt;


        &lt;/LinearLayout&gt;


    &lt;/RelativeLayout&gt;

    &lt;RelativeLayout
        android:id="@+id/relative_layout2"
        android:layout_marginTop="5dp"
        android:layout_below="@+id/relative_layout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"&gt;

        &lt;TextView
            android:id="@+id/parts_number"
            android:layout_width="110dp"
            android:layout_height="40dp"
            android:text="Parts Number"
            android:textColor="#fff"
            android:textSize="15sp"
            android:textStyle="bold"
            android:background="@drawable/shape"
            android:gravity="center"/&gt;

        &lt;LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@+id/parts_number"
            android:layout_marginLeft="20dp"
            android:orientation="horizontal"&gt;

            &lt;EditText
                android:id="@+id/et_Pnumber"
                android:layout_width="0dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:hint="text"
                android:singleLine="true"
                android:inputType="text"
                android:textSize="20sp"
                android:paddingLeft="20dp"
                android:imeOptions="actionNext"
                android:background="@drawable/shape_edit_text"
                /&gt;

            &lt;!-- &lt;ImageButton
                 android:id="@+id/add_et_parts_number"
                 android:layout_width="0dp"
                 android:layout_height="50dp"
                 android:background="@null"
                 android:src="@android:drawable/ic_input_add"
                 android:layout_weight="0.2"/&gt;--&gt;

        &lt;/LinearLayout&gt;

    &lt;/RelativeLayout&gt;


&lt;/LinearLayout&gt; 
</code></pre>