これはリストを展開するかわいいクッキーカッタープログラムで、子供をクリックすると「子供がクリックされました」というメッセージが表示されます。しかし、拡張可能なリストをレシピで構成して、クリックすると材料のポップアップウィンドウが表示されるようにしたいのです。文字列ではなくオブジェクトの配列リストにして、オブジェクトに材料のリストを含めてみましたが、材料を表示しようとすると、すべてが絡まってしまいました。よろしくお願いします。
package com.poe.poeguide;
import java.util.ArrayList;
import com.actionbarsherlock.app.SherlockActivity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ExpandableListView;
import android.widget.Toast;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.ActionBar.OnNavigationListener;
import com.actionbarsherlock.view.MenuItem;
import android.widget.ExpandableListView.OnChildClickListener;
public class Recipes extends SherlockActivity {
private ExpandableListView mExpandableList;
 /** An array of strings to populate dropdown list */
String[] actions = new String[] {
   "Recipes",
   "Main Page",
   "Attributes",
};
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_recipes);
    /** Create an array adapter to populate dropdownlist */
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(getBaseContext(), R.layout.sherlock_spinner_item, actions);
    /** Enabling dropdown list navigation for the action bar */
    getSupportActionBar().setNavigationMode(com.actionbarsherlock.app.ActionBar.NAVIGATION_MODE_LIST);
    /** Defining Navigation listener */
    ActionBar.OnNavigationListener navigationListener = new OnNavigationListener() {
        @Override
        public boolean onNavigationItemSelected(int itemPosition, long itemId) {
            switch(itemPosition) {
            case 0:
                break;
            case 1:
                Intent a = new Intent(Recipes.this, MainActivity.class);
                startActivity(a);
                break;
            }
            return false;
        }
    };
    getSupportActionBar().setListNavigationCallbacks(adapter, navigationListener);
    adapter.setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
    mExpandableList = (ExpandableListView)findViewById(R.id.expandable_list);
    ArrayList<Parent> arrayParents = new ArrayList<Parent>();
    ArrayList<String> arrayChildren = new ArrayList<String>();
    //======================================================================================
    //here we set the parents and the children
        //for each "i" create a new Parent object to set the title and the children
        Parent parent = new Parent();
        parent.setTitle("Pies");
        arrayChildren.add("Apple Pie ");
        arrayChildren.add("Blueberry Pie ");
        parent.setArrayChildren(arrayChildren);
        //in this array we add the Parent object. We will use the arrayParents at the setAdapter
        arrayParents.add(parent);
    //======================================================================================
    //sets the adapter that provides data to the list.
    mExpandableList.setAdapter(new MyCustomAdapter(Recipes.this,arrayParents));
    mExpandableList.setOnChildClickListener(new OnChildClickListener()
    {
        @Override
        public boolean onChildClick(ExpandableListView arg0, View arg1, int arg2, int arg3, long arg4)
        {
            Toast.makeText(getBaseContext(), "Child clicked", Toast.LENGTH_LONG).show();
            return false;
        }
    });
}
@Override
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
    getSupportMenuInflater().inflate(R.menu.activity_recipes, menu);
    return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // This ID represents the Home or Up button. In the case of this
        // activity, the Up button is shown. Use NavUtils to allow users
        // to navigate up one level in the application structure. For
        // more details, see the Navigation pattern on Android Design:
        //
        // http://developer.android.com/design/patterns/navigation.html#up-vs-back
        //
        NavUtils.navigateUpFromSameTask(this);
        return true;
    }
    return super.onOptionsItemSelected(item);
}
}