krissini
krissini

Reputation: 31

android app doesn't work on tablet

I recently uploaded a game on the google play store and it works for little cellphones. However when I try to run it on my nexus 7 (much bigger screen) it starts the app, but not the surfaceView activity... this is the error:

java.lang.IllegalArgumentException: x + width must be <= bitmap.width()
    at android.graphics.Bitmap.createBitmap(Bitmap.java:667)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:634)
    at de.krissini.server.Player.<init>(Player.java:26)
    at de.krissini.server.GamePanel2.surfaceCreated(GamePanel2.java:62)
    at android.view.SurfaceView.updateWindow(SurfaceView.java:580)
    at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:176)
    at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)

Upvotes: 1

Views: 72

Answers (1)

Anil Raavi
Anil Raavi

Reputation: 139

This is all because of your bitmap operation , somewhere you are misusing x coordinate of your bitmap.

For example,Assume that your bitmap size is 1020*720, if you crop your bitmap with 1050*720 it throws IllegalArgumentException.

Make sure that your x and y points are with in the range of given bitmap.

Hope my answer helps .

Upvotes: 1

Related Questions