Getting data from xml in android -


I'm working on Android apps In my app I got an XML data response from the server and it was stored in the string. Now I need to appear in every value and dropdown of that XML. How can i do it Please help me with this. Be truly grateful.

My XML data:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Root & gt; & Lt; Status & gt; First & lt; Status & gt; & Lt; Details & gt; Very cool & lt; / Description & gt; & Lt; FirstNames & gt; & Lt; Name & gt; CoderzHeaven & lt; / Name & gt; & Lt; Name & gt; Android & lt; / Name & gt; & Lt; Name & gt; Iphone & lt; / Name & gt; & Lt; / FirstNames & gt; & Lt; SecondNames & gt; & Lt; Name & gt; Google & lt; / Name & gt; & Lt; Name & gt; Android & lt; / Name & gt; & Lt; / SecondNames & gt; & Lt; / Root & gt;  

I'm getting the above mentioned xml data from the server. Now I have to display that listview. How do I get those values ​​using xmlparser? I tried with various examples, but this did not work for me.

You must create an additional class and parameter your adapter with the object of this class, for example Will look like a data model:

  public class dataclass {private string status, description; Private Array List & lt; String & gt; Name, email name; Public DataClass () {fnames = new ArrayList & lt; String & gt; (); Lnames = new ArrayList & lt; String & gt; (); } Public string getStatus () {return status; } Public Zero setstats (string position) {this.status = status; } Public string getDescription () {return details; } Public Zero Setdition (string description) {this.description = description; } Public Array List & lt; String & gt; GetFnames () {Back Name; } Public Array List & lt; String & gt; GetLnames () {returns lnames; }}  

For XML parser, there are really many examples, if you can use search, then you are certainly in profit. Just to give you a quick point, tutorials,

If you have problems, then what you tried to do after your efforts and code which you did not work, you will get help, otherwise nobody is going to write code for you.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -