I have an expandable list view that houses a short survey (3-4 fields for a user to insert data about) per record that we have. Then we have a button that they can hit to submit the data to our server. When they hit the button I need it to grab all the data in the surveys and send it to our site. I have the sending portion of it figured out; what I'm struggling with is grabbing all the data from the survey.

I've looked through many of the related posts/google results and attempted to implement and adapt their solution for listviews to expandedlistviews but I have not been able to get any of them working. I've spent quite a few hours trying to get some workable solution but alas, I cannot figure it out.

I think part of my problem is I'm not exactly certain how children views come into play for expandable list views. In any event below is my code in hopes that someone smarter than me can help me solve this problem.

So I have my ExpandableListView fragment\_survey.xml: 

```
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    tools:context="edu.ucr.aum.fragments.SurveyFragment$PlaceholderFragment">

    <ExpandableListView
        android:id="@+id/list_view_survey_list"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="@dimen/rowPaddingMedium"
        android:layout_marginRight="@dimen/rowPaddingMedium"
        android:divider="@null"
        android:dividerHeight="0dp"
        android:clipToPadding="false"
        android:scrollbarStyle="outsideOverlay" />

    <TextView
        android:id="@+id/tvResponseCode"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/list_view_survey_list"
        android:text="Response Code: "/>

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Submit Survey"
        android:layout_below="@+id/tvResponseCode"
        android:id="@+id/btnSubmitSurvey" />

</RelativeLayout>

```

And here is my row xml list\_view\_survey\_row.xml:

```
    <TextView
        android:id="@+id/tvSurveyTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/surveyTitle" />

    <TextView
        android:id="@+id/tvSurveyShared"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:text="@string/surveyShared"
        android:layout_below="@+id/tvSurveyTitle"
        />

    <RadioGroup
        android:id="@+id/radioShared"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/tvSurveyShared">

    <RadioButton
            android:id="@+id/radioButtonYes"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/yes"
            android:focusable="true"/>

        <RadioButton
            android:id="@+id/radioButtonNo"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/no"
            android:focusable="true"/>

    </RadioGroup>

<TextView
        android:id="@+id/tvSurveyReason"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/surveyReason"
        android:layout_below="@+id/radioShared" />

    <TextView
        android:id="@+id/tvSurveyRating"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:text="@string/surveyRating"
        android:layout_below="@+id/tvSurveyReason" />

    <CheckBox
        android:id="@+id/checkBoxInterest"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/surveyInterestPositive"
        android:layout_below="@+id/tvSurveyRating"
        android:focusable="true" />

    <CheckBox
        android:id="@+id/checkBoxPrivacy"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/surveyShareLevelPositive"
        android:layout_below="@+id/checkBoxInterest"
        android:focusable="true" />

    <RatingBar
        android:id="@+id/ratingBar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/checkBoxPrivacy"
        android:focusable="true" />

    <View android:layout_width="fill_parent"
        android:layout_height="2dip"
        android:background="#FF00FF00"
        android:layout_below="@+id/ratingBar" />

```

Then I have a fragment (fragment\_survey.java) which adds an onclicklistener to the button (btnSubmitSurvey) in the fragment\_survey.xml file. That onClickListener() function calls two methods (one to get the data and one to send that data).

```
    this.buttonSubmit.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            getData(v);submitSurvey();
        }
    });

public void getData(View view) {
//get data here
}

public void submitSurvey() {
    // Create a new HttpClient and Post Header
    String url;
    if(Singletons.Debug.debug) {
        url = "url for postback";
    } else {
        url = "url for postback";
    }

    NetworkAsyncTask nat = new NetworkAsyncTask();
    try {
        String response = nat.execute(url).get();
        //Log.d(TAG, "Response: " + response);
    } catch(ExecutionException e) {

    } catch(InterruptedException e) {

    }
}

```