Chika
Chika

Reputation: 149

Codenameone Physical Device vs Simulator

Hello I just developed an application in codenameone and it is working perfectly fine in simulator but when I install the same application on a physical device the size of all objects drawn are reduce. I want to maintain the same size as it is in simulator. Simulator skin used is : appleipadamini Physical device used is : Apple ipad mini 4 Simulator height and width chosen is 1000 X 700 but the same when installed on physical device it is just half of the screen.

And the second image is of physical device

Please Help!!!!!!!!!!!!!!!!!!

Hello, as you had answered, I changed the pixel values from 1000 X 700 to exact size of the actual device that is 2048 X 1536. But no am getting an error when the form is rendered.

An exception occurred during transition paint this might be valid in case of a resize in the middle of a transition.
 java.lang.NullPointerException at sun.java2d.SunGraphics2D.getClipBounds(Unknown Source)
 at sun.java2d.SunGraphics2D.getClipBounds(Unknown Source)
 at com.codename1.impl.javase.JavaSEPort.getClipX(JavaSEPort.java:3675)
 at com.codename1.ui.Graphics.getClipX(Graphics.java:171)
 at com.codename1.ui.Component.paintInternalImpl(Component.java:1255)
 at com.codename1.ui.Component.paintInternal(Component.java:1242)
 at com.codename1.ui.Container.paint(Container.java:1290)
 at com.codename1.ui.Component.internalPaintImpl(Component.java:1293)
 at com.codename1.ui.Component.paintInternalImpl(Component.java:1267)
 at com.codename1.ui.Component.paintInternal(Component.java:1242)
 at com.codename1.ui.Component.paintInternal(Component.java:1210)
 at com.codename1.ui.Component.paintComponent(Component.java:1488)
 at  com.codename1.ui.animations.CommonTransitions.paint(CommonTransitions.java:1164)
 at com.codename1.ui.animations.CommonTransitions.paint(CommonTransitions.java:723)
 at com.codename1.ui.Display.paintTransitionAnimation(Display.java:922)
 at com.codename1.ui.Display.edtLoopImpl(Display.java:1041)
 at com.codename1.ui.Display.mainEDTLoop(Display.java:994)
 at com.codename1.ui.RunnableWrapper.run(RunnableWrapper.java:120)
 at com.codename1.impl.CodenameOneThread.run(CodenameOneThread.java:176)
 [EDT] 0:0:0,1 - java.lang.ArithmeticException: / by zero
 [EDT] 0:0:0,1 - java.lang.ArithmeticException: / by zero

Upvotes: 1

Views: 135

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

You are using a skin representing the iPad Mini 1 and running on a new retina device which has double the amount of pixels.

You can't rely on the amount of pixels on the screen and need to write your code to support varying densities. That is why we have layout managers, multi-images etc. This is discussed to some degree in the developer guide.

Upvotes: 0

Related Questions