0

first of all, I have to say that I am completely noob in android programming...

Excuse me if I don´t ask properly my question

I was working with Last.FM and its API but I have got so many errors that I get angry :( so I hope you can help me..

Ok I supposed that last.fm API uses XML, so I started developing with JSON, but I have learnt that it wasn´t the way. I decided to search more, I found something about XML parser, but i am not sure if that is the correct way...

I wanted to fill a list with all tracks of an artist. Example: http://ws.audioscrobbler.com/2.0/?method=artist.gettoptracks&artist=terror&api_key=b25b959554ed76058ac220b7b2e0a026

Anyone can help me with this? Which is the correct(and simplest) way to program something like this? How to do it?

THANKS A LOT!

For those people who haven´t worked with Last.FM API here is its documentation

http://www.lastfm.es/api

BamsBamx
  • 4,139
  • 4
  • 38
  • 63
  • something important. If it's your API key, edit the question and remove it. Having your key means that people can file requests and stuff with your account. you don't want it public. even if it's 'just' Last.fm – La bla bla Aug 10 '12 at 23:44

2 Answers2

0

You can write your own parser which I'm guessing is beyond your skill level. Or you can search around for "last.fm java xml parser"

The following post shows how to use XPath to parse xml files from the last.fm api.

XML parsing in java with xpath

Alternatively, you can take a look at how the following project deals with last.fm API stuff :

http://code.google.com/p/jaudioscrobbler/

Community
  • 1
  • 1
Akos Cz
  • 12,711
  • 1
  • 37
  • 32
0

I highly recommend using Simple Framework for serializing/deserializing XML. It's lightweight and easy to use. I've used it in Android projects in the past and have been happy with it.

Don't reinvent the wheel and try to parse the XML yourself. This will take care of it and allow you to marshal XML responses into domain objects with a single line of code.

Tyler Treat
  • 14,640
  • 15
  • 80
  • 115