Teams Winter 2011/team1/Android/Adding Functionality to Main Screen Elements

From CDOT Wiki
Revision as of 14:41, 25 March 2011 by Azea (talk | contribs)
Jump to: navigation, search

3. Adding Functionality to Main Screen Elements

3.1. Inside the ContractList class create a String array:

    protected String[] studentList = { "Anastasia Semionova", "Minoo Ziaei",
            "Ladan Zadeh", "Sergiu Ecob" };
 

3.2. Populate the listView on the main screen:

   ListAdapter adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_1, studentList);
        ListView contactsList = (ListView) findViewById(R.id.listView1);
        contactsList.setAdapter(adapter);
 

3.3. run the application:
A main5.png
3.4.