Difference between revisions of "Teams Winter 2011/team1/Android/Adding Functionality to Main Screen Elements"

From CDOT Wiki
Jump to: navigation, search
Line 12: Line 12:
 
         contactsList.setAdapter(adapter);
 
         contactsList.setAdapter(adapter);
 
  </pre>
 
  </pre>
 +
3.3. run the application:<br/>
 +
[[Image: A_main5.png | 450px]]<br/>
 +
3.4.

Revision as of 14:41, 25 March 2011

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.