I am trying to animate some movements of a person on my device. I have created a sprite sheet, which ends up being 1.23Mb. The image dimensions is 5000 by 1500 pix. The sheet has 8 rows, each is it's own action. (Walk on, bow, jump...). The longest action is 32 images. So the image is basically 32 columns, by 8 rows. So, now I load it:
As soon as I do this:
private Bitmap bmp;
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.myImage);
I get an error:
Thread [<1> main] (Suspended (exception OutOfMemoryError))
BitmapFactory.decodeResource(Resources, int, BitmapFactory$Options) line: 385 BitmapFactory.decodeResource(Resources, int) line: 404
GameView.(Context) line: 25 FightActivity.onCreate(Bundle) line: 13 FightActivity(Activity).performCreate(Bundle) line: 4465
Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1049
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1920
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1981 ActivityThread.access$600(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 123
ActivityThread$H.handleMessage(Message) line: 1147
ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 137 ActivityThread.main(String[]) line: 4424
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 511 ZygoteInit$MethodAndArgsCaller.run() line: 784
ZygoteInit.main(String[]) line: 551 NativeStart.main(String[]) line: not available [native method]
Am I limited to a certain file size? Seems strange? And if so, is my only option to split the sprites onto separate 'action' images, as opposed to a sequence of action images per row in one large sprite sheet?
Hope someone can assist a novice.