Code example for ListView

Methods: getContextsetAdapter

0
	 */ 
	private void attachAdapter(final ListView list) {
		 
		// Make a trivial adapter that loads an array of strings 
		ArrayAdapter<String> numbers = new ArrayAdapter<String>(
				list.getContext().getApplicationContext(),
                android.R.layout.simple_list_item_1, 
                new String [] {
                "one", "two", "three", "four", "five", "six" 
	        }); 
		 
		// tell the list to use it 
        list.setAdapter(numbers);
        // l.setOnItemClickListener(this); 
	} 
 
	// //////////////////////////////////////////////////////////////////////////// 
	// Implementation of the OnItemClickListener interface 
	// //////////////////////////////////////////////////////////////////////////// 
 
Contextual code suggestions in your IDE  Get Codota for Java