Android app crashes if I declare more than 3 Drawables -
i'm making simple dice app in android studio right , have 6 drawables each side of die. here code looks like:
final drawable die1 = contextcompat.getdrawable(this, r.drawable.die1); final drawable die2 = contextcompat.getdrawable(this, r.drawable.die2); final drawable die3 = contextcompat.getdrawable(this, r.drawable.die3); final drawable die4 = contextcompat.getdrawable(this, r.drawable.die4); final drawable die5 = contextcompat.getdrawable(this, r.drawable.die5); final drawable die6 = contextcompat.getdrawable(this, r.drawable.die6);
the app runs fine when 3 of drawables commented out, doesn't run in emulator if more 3 uncommented. tried fixing building apk , running app on phone, doesn't run if 1 of drawables uncommented. if are, app runs, it's blank screen.
thanks help
as outofmemory
error, can use small size png images overcome outofmemory
error. if want use existing images, can shrink images using tinypng online tool.
Comments
Post a Comment