-2

I am doing an android application which has to get some data from the server pc (stored in xml file) and display it in my app. Suppose the xml data is: Example.xml

<Data>
      <Parameter_1>anitha</Parameter_1>
      <Parameter_2>23-04-2000</Parameter_2>
      <Parameter_3>12:09:00</Parameter_3>
</Data>

The above xml file is stored in my server pc. Now I want to display the values "anitha", "23-04-2000" and "12:09:00" in my android application using Toast feature. I think Xmlpullparser is the best for parsing values from the xml file in android apps. Can anyone post the sample code to get those values from server to my app??

Thanks in advance!!

athira09
  • 155
  • 1
  • 3
  • 18

3 Answers3

1

I don't know what exactly I did but it somehow solved my problem. Now I'm able to get data stored in xml file in the server pc and display in my android app programmatically using java/android. I can't explain how I achieved this since I myself don't know what made it happen. Anyways, thanks for all the help. I gained more knowledge. Maybe that's how I could solve this.

athira09
  • 155
  • 1
  • 3
  • 18
0

You should check Android APIDemos Apps, you can find them in- android-sdk/samples/apidemos

  1. How to make HttpConnections in Android and Fetch data.
  2. How to parse XML data and store them.
  3. How to show a Toast in Android.

Asking for code will not make you things learn at this beginner level. Try yourself and then ask.

Besides there is a very good site - http://www.vogella.com/tutorials/android.html

Happy Coding :)

Kanak Sony
  • 1,570
  • 1
  • 21
  • 37
  • Thanks for your help. I asked for codes because I am in a hurry. I want to finish this app tomorrow itself. – athira09 Feb 10 '14 at 17:39
  • Check android-sdk/samples/apidemos, It has all what you need. Besides, http://www.vogella.com/tutorials/AndroidNetworking/article.html. http://www.androidhive.info/2011/11/android-xml-parsing-tutorial. http://developer.android.com/training/basics/network-ops/xml.html. http://developer.android.com/guide/topics/ui/notifiers/toasts.html – Kanak Sony Feb 10 '14 at 17:42
  • I know to use Toasts but I am not familiar with Httpconnections and Xmlparsing. Thank you for the links. I'll surely go through them and try my best :) – athira09 Feb 10 '14 at 17:45
  • Just give a look.. I know you can do. – Kanak Sony Feb 10 '14 at 17:46
  • Thank u again for your confidence in me. I somehow want to complete this app tomorrow itself. – athira09 Feb 10 '14 at 17:51
  • I was not able to do it in that way. – athira09 Mar 06 '14 at 05:25
0

Read this post it could help you (Considering that you will access the server via Http) Read the remote xml file

hope it help

Community
  • 1
  • 1
murielK
  • 1,000
  • 1
  • 10
  • 21