db = (new HomeActivitySqlOpenHelper(this)).getWritableDatabase();
HomeActivity = (ListView) findViewById(R.id.list);
cursor= db.rawQuery("SELECT _id, name, date FROM table1", null);
adapter = new
SimpleCursorAdapter(HomeActivity.this,R.layout.list_item,cursor,new
String[] {"name", "date"},new int[] {R.id.name, R.id.date});
HomeActivity.setAdapter(adapter);
HomeActivity.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?>
a, View v,int position,
long id) {
Intent intent = new
Intent(HomeActivity.this,
PersonDetails.class);
Cursor cursor = (Cursor)
adapter.getItem(position);
intent.putExtra("table1_ID",
cursor.getInt(cursor.getColumnIndex("_id")));
startActivity(intent);
}
});
here new activity is not getting "id"
XML file list_item:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="8px">
<TextView
android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/date"
android:layout_marginLeft="6px"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/name"
android:layout_below="@id/name"/>
</RelativeLayout>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en