I'm recreating one of my activities to work with Action Bar, with much help from Mr. @Wakin I was able to make it work:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gerenciamento);
abrebanco();
buscardados();
gerelista();
//String[] tabelas = tab.toArray(new String[tab.size()]);
List<String> l = getgeraList();
ArrayAdapter<String> ad = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_2, android.R.id.text1, l);
ListView lv = (ListView) findViewById(R.id.list);
lv.setAdapter(ad);
}
private List<String> getgeraList() {
List<String> l = new ArrayList<String>();
cursor.moveToLast();
int x=cursor.getCount();
int y=0;
while(y<x){
//nextdado();
l.add(retornadado());
dadoanterior();
y++;
}
return l;
}
I need to return the contents of what was written in the listview that was selected by the user.
The problem that the function:
lv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
of the error. I also can not get the contents of the list.