Tuesday, 13 August 2013

Getting screen size return 0

Getting screen size return 0

im trying to get the screen size on my emulator (API 7) with this code:
float scaledDensity = this.getResources().getDisplayMetrics().scaledDensity;
Now i try to use scaledDensity
with this code:
int width = (width / ((int) scaledDensity)) / 7;
and i get this exception
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.tomer.workoutlog2/com.example.workoutlog.SimpleCalendarViewActivity}:
java.lang.ArithmeticException: divide by zero
On my real device i dont get this error. Maybe the problem is with the
emulator?

No comments:

Post a Comment