Android: How to replace existing xml database file with new xml database file in android



I have an Android application which takes the data to be displayed from a xml file (data.xml). The structure of the project is shown below.


enter image description here


I need a local copy of this file in application for sure.I want to update this file with new data or replace it with new file when it finds the internet connectivity. Update the file only if it is different from file saved at remote location.


I have a method to checks internet connectivity, which is called as shown below.



if (isConnectivity(this)) {
// what should be the code here
} else {
addresses = parser.parseXML(getAssets().open("data.xml"));
}


What are the ways to do so or any other solution to make it working.


No comments:

Post a Comment