0
My situation is as follows, my listview loads the items into an xml I created for each listview item
At the time listing is like this: What I want to do is, by clicking, take these items circled in red, either by the ID, or the way it is, and send to another Activite, but so far I’ve managed to get the ID of each item in the listview.
Method to load database data:
public Cursor loadData(){
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TableEstructure.Table.TABLE_NAME,null,null,null,null,null,null,null);
return cursor;
}
Method to load data in listview:
public void loadRegisters(){
db = new DataBase(MainActivity.this);
String[] from = {
TableEstructure.Table.COLUMN_ID,
TableEstructure.Table.COLUMN_DATE,
TableEstructure.Table.COLUMN_STATE,
TableEstructure.Table.COLUMN_CUTED_TREES,
TableEstructure.Table.COLUMN_VOLUME_CUTED_TREES};
int[]to = {R.id.txtId,
R.id.textState,
R.id.textDate,
R.id.textCutedTrees,
R.id.txtVolCutTree};
SimpleCursorAdapter simpleCursorAdapter = new SimpleCursorAdapter(getApplicationContext(),R.layout.item_list,db.loadData(),from,to);
list.setAdapter(simpleCursorAdapter);
}
Does anyone have a solution to my problem? most grateful at once!
Change of plans! Instead of trying to get the Itemlistview items in the click, I passed the Id of the clicked item and in the following activitie I made a query through it and used the data.
– Igor