Ok, here's what I ended up doing:
AssetManager am = this.getResources().getAssets();
InputStream is = null;
try {
is = am.open("ok.txt");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Scanner s = new Scanner(is);
long numfloats = s.nextLong();
float[] f = new float[(int) numfloats];
for (int ctr = 0; ctr < f.length; ctr++) {
f[ctr] = s.nextFloat();
}
On Oct 3, 12:07 pm, Kostya Vasilyev <[email protected]> wrote:
> Why not allocate the array dynamically and read it from an asset
> packaged within the .apk?
>
> You'll most likely need it in a dynamically allocated array anyway (such
> as an NIO buffer), keeping another copy in memory as a Java constant /
> variable just seems like a waste.
>
> -- Kostya
>
> 03.10.2011 20:57, bob пишет:
>
>
>
>
>
>
>
>
>
> > I changed it to float. Same Error.
>
> > I changed it to static. Slightly different error:
>
> > The code for the static initializer is exceeding the 65535 bytes limit
>
> > On Oct 3, 8:48 am, Kristopher Micinski<[email protected]> wrote:
> >> If you go down to float you get half the size, ~16kb vs ~8kb?
>
> >> Kris
>
> >> On Mon, Oct 3, 2011 at 9:44 AM, Oli<[email protected]> wrote:
> >>> OK, I don't know the source of that error off the top of my head, but
> >>> a hunch would suggest you should consider whether you need that level
> >>> of precision in your co-ordinates!
> >>> On Oct 3, 12:37 pm, bob<[email protected]> wrote:
> >>>> So, I had a great idea. Why don't I stick my 3d model in as an array?
> >>>> Here's the result:
> >>>>https://sites.google.com/site/coolfonne/Spaceship.java
> >>>> Now, I get this error:
> >>>> The code of constructor Spaceship() is exceeding the 65535 bytes limit
> >>>> Is there any easy way around this?
> >>> --
> >>> You received this message because you are subscribed to the Google
> >>> Groups "Android Developers" group.
> >>> To post to this group, send email to [email protected]
> >>> To unsubscribe from this group, send email to
> >>> [email protected]
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/android-developers?hl=en
>
> --
> Kostya Vasilyev
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en