Friday, 27 February 2015

How to display part of XML file while downloading the rest of the XML



I'm creating a new Android application. I have a big XML file which is basically a big RelativeLayout with multiple ScrollView inside it.


< RelativeLayout >



< ScrollView
...
android:visibilty="visible">

</ScrollView>


<ScrollView
...
android:visibilty="gone">

</ScrollView>


<ScrollView
...
android:visibilty="gone">

</ScrollView>

...


< /RelativeLayout>


The problem is that this activity takes forever to load (several seconds). As this XML is only composed of several ScrollView and only one of this ScrollView has a "visible" visibilty at a time (the others are "gone"), I would like to display the first ScrollView as soon as it has been loaded without having to wait for the other ScrollViews.


I checked on google and one solution that appeared to be pretty good is to use a "XMLPullParser" (http://ift.tt/1gQRT2N). Unfortunately, if I understand well, you can just say to the XMLPullParser to drop some parts of the XML but it has to go through the entier XML file anyway.


Does someone have a solution to my problem ?


Thanks :)


No comments:

Post a Comment