Code example for ArrayAdapter

Methods: clearnotifyDataSetChanged

0
 
		clearButton = (Button) this.findViewById(R.id.clearButton);
		clearButton.setOnClickListener(new OnClickListener() {
			@Override 
			public void onClick(View v) {
				adapter.clear();
				adapter.notifyDataSetChanged();
			} 
		}); 
 
		listView = (ListView) this.findViewById(R.id.ListView);
		listView.setOnItemClickListener(new OnItemClickListener() {
			@Override 
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long duration) {
				Toast.makeText(
						getApplicationContext(),
						"Selected " + adapter.getItem(position) + " @ "
								+ position, Toast.LENGTH_SHORT).show();
			} 
		});