You just need to add what you have in the populateListView method to the listener:
public void onCheckedChanged(RadioGroup group, int checkedId) {
if(checkedId == R.id.radio0){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.mainitem, items);
ListView list = (ListView) findViewById(R.id.listView1);
list.setAdapter(adapter);
} else if(checkedId == R.id.radio1){
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.mainitem, items2);
ListView list = (ListView) findViewById(R.id.listView1);
list.setAdapter(adapter);
}
}
If you want to hide or clear the list when you clear the RadioGroup selection you just need to add an extra if for when it returns -1 and make the changes to the listview. From the android reference: "When the selection is cleared, checkedId is -1."
if (checkedId == -1) { ... }