Android : get database id from row listview android

on Sunday, August 17, 2014


lv.setOnItemClickListener(new OnItemClickListener() {



@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long rid) {

lv.getAdapter().getItem(position);
Intent intent = new Intent(getActivity()
.getApplicationContext(), RestaurantActivity.class);
intent.putExtra("restaurant_id", restid);
startActivity(intent);

}
});


lv.getAdapter().getItem(position) GIVES ME


{number_of_orders=1 offer, restaurant_id=5, distance=5.0 km, restaurantname=Brookside}


I want only restaurant_id value, i.e. 5.


How can i achieve this?


0 comments:

Post a Comment