Eric
Eric

Reputation: 1557

How to get one value from Hashmap to intent without using textview?


I retrieve few data from database then store it into hashmap and display it on listview.

HashMap<String, String> map = new HashMap<String, String>();

            map.put(TAG_NAME, name);
            map.put(TAG_ADDRESS, address);
            map.put(TAG_VID, vid);
            venueList.add(map);

This is the value i wanna past to another page.


@Override
        public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
            // getting values from selected ListItem
            String name = ((TextView) view.findViewById(R.id.name)).getText().toString();
            String address = ((TextView) view.findViewById(R.id.address)).getText().toString();
            String vid = "NEED HELP HERE"

            // Starting new intent
            Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
            in.putExtra(TAG_NAME, name);
            in.putExtra(TAG_ADDRESS, address);
            in.putExtra(TAG_VID, vid);
            startActivity(in);
        }

I manage to pass the value which are display on TextView, but how do i pass the VID which are not TextView??

String vid = getListAdapter().getItem(position).toString();

I tried this but it show all the data. How do i select one particular VID??

Thanks.

Upvotes: 1

Views: 1586

Answers (1)

waqaslam
waqaslam

Reputation: 68187

You can put vid into bundle directly from map

in.putExtra(TAG_VID, map.get(TAG_VID));

Upvotes: 1

Related Questions