The Source for Java Technology Collaboration

Home » java.net Forums » Mobile & Embedded » ME Interest

Thread: Get Device Screen Size - J2ME

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Last Post: Jul 1, 2009 8:47 PM by: ims_lab Threads: [ Previous | Next ]
Ankit Shah
Get Device Screen Size - J2ME
Posted: Aug 28, 2008 12:10 AM
  Click to reply to this thread Reply

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]


Abhinav Holkar
Re: Get Device Screen Size - J2ME
Posted: Aug 28, 2008 12:30 AM   in response to: Ankit Shah
  Click to reply to this thread Reply


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

Posts: 40
Re: Get Device Screen Size - J2ME
Posted: Jun 30, 2009 11:30 PM   in response to: Abhinav Holkar
  Click to reply to this thread Reply

Hi,

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

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

sfitzjava

Posts: 263
Re: Get Device Screen Size - J2ME
Posted: Jul 1, 2009 7:51 AM   in response to: ims_lab
  Click to reply to this thread Reply

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

Posts: 40
Re: Get Device Screen Size - J2ME
Posted: Jul 1, 2009 8:47 PM   in response to: sfitzjava
  Click to reply to this thread Reply

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!




 XML java.net RSS