java - Storing data on ListView item -
first of i'm new android. might simple question couldn't find answer myself.
i have 2 activity, i'm filling first 1 user names , other data receive remote request , second 1 being used display details of selected user.
so in way need associate user records listview items, can pass of these information the second activity using intent. i'm not sure if it's right or wrong found need create custom arrayadapter. i've created user class:
class user { public string id; public string name; }
and guess need write like:
class useradapter extends arrayadapter<user> { ... }
basically in first view want display:
john doe mike brown ...
second 1 make request based on user.id , display information user like:
john doe, 45, san francisco
i couldn't find similar example i'm not sure how can that. reference helpful.
thanks.
in "getview" method of useradapter, set tag of view useful...
view.settag(id);
then can pull information out when clicked...
@override public void onitemclick(adapterview<?> parent, view view, int position, long id) { integer id = (integer) view.gettag(); // ... }
Comments
Post a Comment