Tuesday, May 18, 2010

[android-developers] Display progress of xml parsing?

Hopefully I am giving everyone an easy question.

I'd like to be able to show progress of parsing an xml file in
progress.

I know it is more or less customary to use an AsyncTask and to have it
update something like a progress bar dialog.

XmlPullParser lets you get the line number. That's good for the
numerator.

Now for the denominator. There's no way I can see of getting the total
number of lines in the file. I could check the file at the beginning
and see how many bytes are in the file. But number of lines / number
of bytes doesn't match up.

At the moment, I'd probably be stuck with an indeterminate progress
bar. Or just posting the line number so the user can at least see it
making it progress and not panic.

Nathan

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment