Problem With Populating Textviews From Db Rowid
I am trying to make a program that has 2 views. The first view is a list populated from a database. What i want is, when i click an item of the list then i want the program to open
Solution 1:
Your onListItemClick() should look like this..
@OverridepublicvoidonListItemClick(ListView list, View view, int position, long id){
Intenti=newIntent(meeting_list.this, ACTIVITY.class);
i.putExtra(ID_EXTRA, String.valueOf(id));
startActivity(i);
}
In the next activity just retrieve the ID.
Also put a log message to log the ID to insure it is being passed
Here to the passing activity retrieve it.
ID = getIntent().getStringExtra(ACTIVITY.ID_EXTRA);
//USe this to load the data with a cursor
publicvoidload(){
Cursor c = helper.getByID(meetingId);
There should be a method in your database to getById(). Like this..
publicCursorgetByID(String id){
String [] args={id};
return(getReadableDatabase().rawQuery("SELECT _id, meetingTitle, meetingDescrip, meetingAdress, meetingDateTime, lat, lon, type FROM meetings WHERE _ID=?", args));
Just substitute your return arg's for mine.
Post a Comment for "Problem With Populating Textviews From Db Rowid"