I have an Activity with a button calling a List Activity. This ListActivity quickly creates a string list, I just want to show this list on the screen and display the selected item in a Toast.
But it's not working! Here is the code for the List class
public class Lista extends ListActivity{
protected void OnCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
String[] itens = new String[]{"João","josé","pedro",};
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,itens);
setListAdapter(adapter);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Object o = this.getListAdapter().getItem(position);
String item = o.toString();
Toast.makeText(this, "Clicou em: "+item, Toast.LENGTH_SHORT).show();
}
}
What's missing?