Skip to main content

Get Device Screen Size - J2ME

4 replies [Last post]
Anonymous

Hi,

I am developing application for MIDP 2.0 based devices and and i would like
to fetch mobile device screen size programmatically. Is there any way
through which i can get device screen size/resolution?

Any help and support is much appreciated. Thank you.

Best Regards,
Ankit

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Abhinav Holkar

Hi Ankit,
Please use " Displayable.getWidth() / getHeight()...." .

Best regards,
Abhinav
Impetus
-----Original Message-----
From: A mailing list for KVM discussion [mailto:KVM-INTEREST@JAVA.SUN.COM] On Behalf Of Ankit Shah
Sent: Thursday, August 28, 2008 12:41 PM
To: KVM-INTEREST@JAVA.SUN.COM
Subject: Get Device Screen Size - J2ME

Hi,

I am developing application for MIDP 2.0 based devices and and i would like to fetch mobile device screen size programmatically. Is there any way through which i can get device screen size/resolution?

Any help and support is much appreciated. Thank you.

Best Regards,
Ankit
=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff KVM-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".

________________________________
NOTE: This message may contain information that is confidential, proprietary, privileged or otherwise protected by law. The message is intended solely for the named addressee. If received in error, please destroy and notify the sender. Any use of this email is prohibited when received in error. Impetus does not represent, warrant and/or guarantee, that the integrity of this communication has been maintained nor that the communication is free of errors, virus, interception or interference.

Impetus is the winner of the Economic Times Intel Smart Workplace Awards 2008 and the CNBC emerging India 2008. Visit www.impetus.com for details.

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff KVM-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".
[att1.html]

ims_lab
Offline
Joined: 2009-01-05
Points: 0

Hi,

I am using J2ME lwuit. In this Displayable is not recognized.

Kindly suggest how can i get the screen resolution/size.

sfitzjava
Offline
Joined: 2003-06-15
Points: 0

Just create an Alert object and use that.

Alert tmp = new Alert("just getting screen size");
int w = tmp.getWidth();
int h = tmp.getHeight();
tmp = null;

You don't have to put it on the screen... and you can pass in a blank string "" to the constructor if you want. If there is an Alert in LWUIT then fully qualify the class name javax.microedition.lcdui.Alert

-Shawn

ims_lab
Offline
Joined: 2009-01-05
Points: 0

I did that using Display.getInstance().getDisplayWidth() and Display.getInstance().getDisplayHeight().

This gives same result as getWidth() and getHeight(). So any can be used.

Thank you!