android - Populating SQLite ListViews Dynamically in Real-time, Between Activities, Using onListItemClicks/intents/other? -
i'm new android, , basic user flow of app accounted for, can sense of accomplishment keep me interested enough work on areas of it. know isn't best practice, go later , make sure have multi-threading, singleton db, async, , other stuff. want ui designing part asap.
basically i'm trying update the sql queries based upon onlistitemclicks, , dynamically user navigation.. through authors, keywords, categories, etc.
i have working, , thought sure there way make work corresponds db quite easily, i've yet find anything:
@override
protected void onlistitemclick(listview l, view v, int position, long id) {
log.i("fragmentlist", "authors_id " + id);
here's other code i've tried, failed with:
public void onitemselected(adapterview<?> arg0, view arg1, int arg2, long arg3){}
string selecteditem = (string) getlistadapter().getitem(position); string query = "select body \"main\".\"quotes\" _id = '" + selecteditem + "'";
i've tried huge number of different intent/bundle methods
- http://developer.android.com/reference/android/content/intent.html
- http://developer.android.com/reference/android/os/bundle.html
i able couple of intents pass values across activities, kept getting null values , inconsistent results.
![enter image description here][2]
![enter image description here][3]
intent intent = new intent(mainactivity.this, authorlistactivity.class); bundle bundle = new bundle(); bundle.putint("position", position); bundle.putlong("id", id); intent.putextras(bundle); startactivity(intent);
add part next activity's on create method:
bundle bundle = getintent().getextras(); assert bundle != null; int position = bundle.getint("position"); long id = bundle.getlong("id");
apparently querying lot more lax thought was, demonstrated vogella:
// database creation sql statement private static final string database_create = "create table " + table_todo + "(" + column_id + " integer primary key autoincrement, " + column_category + " text not null, " + column_summary + " text not null," + column_description + " text not null" + ");";
Comments
Post a Comment