Tuesday, September 14, 2010

[android-developers] Re: Loading XML data to array “gives up” if XML is too big

Here is the line where I load the XML into the Array:

TEAM_SCORES = getResources().getStringArray(R.array.TEAM_SCORES)

Here is a clip of the XML for TEAM_SCORES:

<string-array name="TEAM_SCORES">
<item>[1]SD[2]77[3]W1[4]@KC[5]San Diego Chargers[6]R01[7]Mon Sep 13,
10:15 PM[8]</item>
<item>[1]Ari[2]69[3]W1[4]@StL[5]Arizona Cardinals[6]R02[7]Sun Sep 12,
4:15 PM[8]</item>
...
</string-array>

Only instead of two items, there are 512. When I cut it down to, say,
the first 32, everything is fine. The file size of strings.xml on
disk is 44k, which doesn't necessarily sound that large to me. Maybe
it's choking on a certain entry later on in the list?

On Sep 14, 9:04 pm, DanH <danhi...@ieee.org> wrote:
> Maybe you could give us a sample of what you're "loading".
>
> On Sep 14, 7:44 pm, nextgen <nextgenfant...@comcast.net> wrote:
>
>
>
> > Thank you both for the replies. Unfortunately you are stretching my
> > admittedly thin knowledge, only began in Android and Java a month
> > ago.  I'll look into LogCat.  Frank, if you can spare a bit more of
> > your time to explain how to do this at compile time I would be
> > grateful, although I'm sure it's pretty remedial for you.
>
> > On Sep 14, 5:14 pm, Frank Weiss <fewe...@gmail.com> wrote:
>
> > > It's running out of time in onCreate() or running out of memory. If the XML
> > > data is known at compile time, why bother parsing it at run time?
> > > Any messages in LogCat?- Hide quoted text -
>
> - Show quoted text -

--
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