1

I have my ListView set up and populated with an arraylist of strings, my question is how can I get another listview to dropdown when the "Liquid Type" in the ListView is clicked by the user

public class MainActivity extends ActionBarActivity {

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

    ListView mainList = (ListView) findViewById(R.id.add_drink);
    ListView drinkType = (ListView) findViewById(R.id.drink_types);
    ArrayList<String> mainListArray = new ArrayList<String>();


    mainListArray.add("Liquid Type");
    mainListArray.add("How Many?");
    mainListArray.add("Amount");
    mainListArray.add("Extra Calories");


    ArrayAdapter<String> ad = new ArrayAdapter<String>(this, R.layout.list_adapter,R.id.text, mainListArray);

    mainList.setAdapter(ad);

    mainList.setOnItemClickListener(new AdapterView.OnItemClickListener()
    {
        // argument position gives the index of item which is clicked
        public void onItemClick(AdapterView<?> arg0, View v,int position, long arg3)
        {


        }
    });
}
MichaelStoddart
  • 5,571
  • 4
  • 27
  • 49

1 Answers1

0

Have you looked at ExpandableListView http://developer.android.com/reference/android/widget/ExpandableListView.html

What are you trying to do (use case)? The names you have in the list of main items kind of looks like an input form.

Maybe touching a single list item could display a context menu - see Using contextmenu with listview in android

Community
  • 1
  • 1
Dave Truby
  • 193
  • 1
  • 5