I m programming in j2me. How can I prevent screen rotation in j2me for all phones that support screen rotation?
谢谢
I m programming in j2me. How can I prevent screen rotation in j2me for all phones that support screen rotation?
谢谢
添加到显示列表
For Nokia devices: Nokia-MIDlet-App-Orientation : Landscape
For Samsung devices: MIDlet-ScreenMode : Landscape
If you use Canvas to draw your screen (not LCDUI, not LWUIT, not any other framework) you may implement sizeChanged method to be notified when the rotation happens.
在此情况下, 您可以将屏幕拖到图像中, 并使用 Sprite 旋转它。 例如, 只支持在构建器中使用的下面代码的景观模式 :
int width = Math.max(super.getWidth(), super.getHeight()); int height = Math.min(super.getWidth(), super.getHeight()); // screen and sprite are attributes screen = Image.createImage(width, height); sprite = new Sprite(screen); if (super.getWidth() < super.getHeight()) { // portrait screen sprite.setTransform(Sprite.TRANS_ROT90); sprite.setPosition(0, 0); }
以及以下方法:
public void sizeChanged (int w, int h) { // lastWidth and lastHeight are attributes lastWidth = w; lastHeight = h; if (sprite == null) return; if (super.getWidth() < super.getHeight()) { // portrait screen sprite.setTransform(Sprite.TRANS_ROT90); } else { sprite.setTransform(Sprite.TRANS_NONE); } sprite.setPosition(0, 0); } protected void paint(Graphics g1) { if (super.getWidth() != lastWidth || super.getHeight() != lastHeight) { sizeChanged(super.getWidth(), super.getHeight()); } Graphics g = screen.getGraphics(); // ... do your drawing on g this.sprite.setImage(screen, screen.getWidth(), screen.getHeight()); sprite.paint(g1); }
见
I am getting parser exception as "Expecting End of File" while parsing xml data for Blackberry application?
How do I fix it?
ok i made a midlet through which i can connect to server pages and get soem information as response.
For example i made a midlet through which i acced url: http://example.com/?u=nepal&t=1
Now i ...
I have a JavaME project in Eclipse (Pulsar 3.5; Galileo).
I have another project with common code in it in the same workspace and this is referenced from my app.
When I choose package app it ...
Given
private final Vector v = new Vector(); //instance variable
the following 3 lines are in an instance method in the same class.
1. int length = v.capacity();
2. int size = v.size();
...
I m using Sun WTK to run a midlet that needs to send and optionally receive SMS. WMA console can be used to send and receive messages to the midlet but I d like to do the same thing using my own ...
It seems to be the consensus that developing for Java ME is not as cross platform as you might expect, particularly compared to say java SE, but it is difficult to assess how the situation is evolving....
I m writing a Java ME app that will use privileged operations such as messaging. By default the user is prompted to confirm each of these operations, but I would like to run it as a background ...
I am trying to use the hessian j2me implementation @ http://hessian.caucho.com/ using java me sdk 3.0.
http://hessian.caucho.com/doc/hessian-overview.xtp#Hessian%20Client%20for%20a%20cell-phone ...