0

良い説明があり、これは同じことをしようとしている人にとって役立つかもしれません!!!

   public class ExpList extends ExpandableListActivity
{
 String gametype;

  // strings for group elements

    static final String arrGroupelements[] = 
    {
   "POKER TOURNAMENTS",
   "SLOTS TOURNAMENTS",
   "ROULLETTE/CRAPS TOURNAMENTS",
   "BLACKJACK TOURNAMENTS",
   "BINGO/CHARITY BINGO"
 };


  // strings for child elements

 static final String arrChildelements[][] = 
 {
   {
  "TEXAS HOLD'EM",
  "OMAHA HIGH-LOW",
  "SEVEN CARD STUD",
  "THREE CARD POKER",
  "OTHER POKER VARIANTS",
  "ONLINE/SATTELITE TOURNAMENTS"
   },
   {
  "SLOTS"
   },
   {
  "ROULLETTE",
  "CRAPS"

   },
   {
  "BLACKJACK"
   },
   {
       "BINGO"
        }
    };    

そして、次のようにonChildClick関数を操作して、その子が下でクリックされたときに文字列の値を「TEXASHOLD'EM」に設定します。

@Override
        public boolean onChildClick(ExpandableListView parent, View v,
                int groupPosition, int childPosition, long id) {
            //ExpandableListAdapter adapter = getExpandableListAdapter();
            gametype = ExpList.arrChildelements[groupPosition][childPosition];
            //---------------------
            Intent pullt = new Intent(ExpList.this,
                    SearchActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("gametype", gametype);
            pullt.putExtras(bundle);
            pullt.putExtra("gametype", gametype);

            startActivity(pullt);
            //---------------------
            return false;
        }
4

2 に答える 2

0
public class ExpList extends ExpandableListActivity
{
 String gametype;

  // strings for group elements

    static final String arrGroupelements[] = 
    {
   "POKER TOURNAMENTS",
   "SLOTS TOURNAMENTS",
   "ROULLETTE/CRAPS TOURNAMENTS",
   "BLACKJACK TOURNAMENTS",
   "BINGO/CHARITY BINGO"
 };


  // strings for child elements

 static final String arrChildelements[][] = 
 {
   {
  "TEXAS HOLD'EM",
  "OMAHA HIGH-LOW",
  "SEVEN CARD STUD",
  "THREE CARD POKER",
  "OTHER POKER VARIANTS",
  "ONLINE/SATTELITE TOURNAMENTS"
   },
   {
  "SLOTS"
   },
   {
  "ROULLETTE",
  "CRAPS"

   },
   {
  "BLACKJACK"
   },
   {
       "BINGO"
        }
    };    

そして、その子が下でクリックされたときに文字列の値を「TEXAS HOLD 'EM」に設定するために、次のように onChildClick 関数を使用します。

@Override
        public boolean onChildClick(ExpandableListView parent, View v,
                int groupPosition, int childPosition, long id) {
            //ExpandableListAdapter adapter = getExpandableListAdapter();
            gametype = ExpList.arrChildelements[groupPosition][childPosition];
            //---------------------
            Intent pullt = new Intent(ExpList.this,
                    SearchActivity.class);
            Bundle bundle = new Bundle();
            bundle.putString("gametype", gametype);
            pullt.putExtras(bundle);
            pullt.putExtra("gametype", gametype);

            startActivity(pullt);
            //---------------------
            return false;
        }
于 2012-05-24T20:32:58.563 に答える
0

onChildClick()とを取得groupPositionchildPositionます。

ExpandableListAdapter adapter = getExpandableListAdapter();
gametype = adapter.getChild(groupPosition, childPosition).toString;
于 2012-05-24T17:16:17.363 に答える