getyoutubelikes
New Member
I'm searching all over the internet, but I didn't find anything, I could use. So here is my problem: I have an xml parser that works in an list view, but I want to give the id of the song to an other activity , so I can display it.this is my code \[code\]ListView list;LazyAdapter adapter;@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>(); XMLParser parser = new XMLParser(); String xml = parser.getXmlFromUrl(URL); Document doc = parser.getDomElement(xml); NodeList nl = doc.getElementsByTagName(KEY_SONG); for (int i = 0; i < nl.getLength(); i++) { HashMap<String, String> map = new HashMap<String, String>(); Element e = (Element) nl.item(i); map.put(KEY_ID, parser.getValue(e, KEY_ID)); map.put(KEY_TITLE, parser.getValue(e, KEY_TITLE)); map.put(KEY_ARTIST, parser.getValue(e, KEY_ARTIST)); map.put(KEY_DURATION, parser.getValue(e, KEY_DURATION)); map.put(KEY_THUMB_URL, parser.getValue(e, KEY_THUMB_URL)); songsList.add(map); } list=(ListView)findViewById(R.id.list); adapter=new LazyAdapter(this, songsList); list.setAdapter(adapter); list.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id){ Intent intent = new Intent(CustomizedListView.this, Test.class); startActivity(intent); } } ); \[/code\]this is the lazy adapter\[code\]private Activity activity;private ArrayList<HashMap<String, String>> data;private static LayoutInflater inflater=null;public ImageLoader imageLoader; public public LazyAdapter(Activity a, ArrayList<HashMap<String, String>> d) { activity = a; data=http://stackoverflow.com/questions/12621419/d; inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); imageLoader=new ImageLoader(activity.getApplicationContext());}public int getCount() { return data.size();}public Object getItem(int position) { return position;}public long getItemId(int position) { return position;}\[/code\]the xml looks kind of likes this\[code\]<title>Can't get enough</title><ytid>p0L4lA6bS2E</ytid><artist>J.cole</artist<artist2>Trey Songz</artist2><artist3/><playlist>3</playlist<songid>460</songid><toplijst/>\[/code\]