user1169502
user1169502

Reputation: 398

Storing data and files

I am porting an application originally written for WP7 and just need to know how to do something under Mono for Android which I could do on WP7 using IsolatedStorage.

For simple key/value data such as the username and password used to login I am using SharedPreferences and I think that this will work fine, however I read an XML file from a web service and need to be able to store this file locally, be able to update its contents and ultimately upload it back to the web server.

Under WP7 the code would serialize the XML and then save this to application settings - I guess I can do something very similar in Android but the question is this the best way to store an XML data file?

Thanks

Upvotes: 0

Views: 1502

Answers (3)

Matthew
Matthew

Reputation: 5202

You can do almost the same thing as you would on the WP, as the same .net libraries for xml and serialization should be available on Mono for Android.

You can then also save it to isolated storage or wherever you like.

Upvotes: 1

SeanPONeil
SeanPONeil

Reputation: 3910

You can write the XML as a string to a file in the Internal Storage or the SD Card. Check the Developer Documentation for more information: http://developer.android.com/guide/topics/data/data-storage.html

Upvotes: 0

Davos555
Davos555

Reputation: 2004

You can use one of the common java libraries to work with XML, such as JDOM or SAX. You can then write this to android storage as per Maxim's comment link above.

Upvotes: 0

Related Questions