Transplantation of j2s

Source: Internet
Author: User

1:
The screen resolution of Samsung S5320 is 240*400, but there is a virtual keyboard with a height of 80. This virtual keyboard cannot be removed, so the actual screen is 240*320.

If this mobile phone is developed using Canvas, if you use setFullScreenMode (true) separately, full screen is not set. Therefore, you must set a thread on the main interface, and keep this thread running setFullScreenMode (true); To set full screen.

 

2:
Code specification: <1> put all the resources used, just like Android development, in a class named ResourceManager. java.

<2> all the uidesigns use relative coordinates for general purpose.

<3> when each Canvas ends, you must write a release function to release the resource and use System. gc () to recycle the resource.

 

3:
Key-value differences for different mobile phones,

<1> the key value of NOKIA is relatively standard, and almost all Nokia mobile phones have the same key value.

Public static final int KEY_UP =-1;
Public static final int KEY_DOWN =-2;
Public static final int KEY_LEFT =-3;
Public static final int KEY_RIGHT =-4;
Public static final int KEY_FIRE =-5; // specifies the intermediate key.
Public static final int KEY_SOFT_LEFT =-6; // left soft key
Public static final int KEY_SOFT_RIGHT =-7; // right soft key

 

<2> MOTO E2, V8 mobile phone ammonium key:

Public static final int KEY_UP =-1;
Public static final int KEY_DOWN =-2;
Public static final int KEY_LEFT =-3;
Public static final int KEY_RIGHT =-4;
Public static final int KEY_FIRE =-5;
Public static final int KEY_SOFT_LEFT =-21; // left soft key
Public static final int KEY_SOFT_RIGHT =-22; // right soft key

 

 

<3> MOTO E398; L7 --- Key Code
Public static final int KEY_UP =-1;
Public static final int KEY_DOWN =-6;
Public static final int KEY_LEFT =-2;
Public static final int KEY_RIGHT =-5;
Public static final int KEY_FIRE =-20; // intermediate key
Public static final int KEY_SOFT_LEFT =-21; // left soft key
Public static final int KEY_SOFT_RIGHT =-22; // right soft key

 

 

<4> other buttons

 

Public static final int KEY_0 = 48;
Public static final int KEY_1 = 49;
Public static final int KEY_2 = 50;
Public static final int KEY_3 = 51;
Public static final int KEY_4 = 52;
Public static final int KEY_5 = 53;
Public static final int KEY_6 = 54;
Public static final int KEY_7 = 55;
Public static final int KEY_8 = 56;
Public static final int KEY_9 = 57;
Public static final int KEY_POUND = 35;
Public static final int KEY_STAR = 42;

 

 

4:
<1> division> 1, multiplication <1. Instead of using methods such as/2 and * 2.

 

 

 

5: current problems,

 

<1>: On the Moto E6 mobile phone, when the program calls the system browser and returns the program, the program cannot be full screen. I have done the following:

 

SetFullScreenMode (true) is used in the ShowNotify () method );

Set a thread on the main interface to allow the thread to continuously execute setFullScreenMode (true );

Set setFullScreenMode (true)/In sizeChanged (int w, int h )/

 

 

I can't use any of the above methods. I don't know how that expert knows. How can this problem be solved?

 

 

The solution to this problem is as follows:

 

Set a boolean keyIsValide on the main interface

 

When the browser is called, The keyIsValide is set to false, that is, the first time the browser returns the key,

When the browser returns, when the user first touches the screen, the keyIsValide = true is returned to the original state, and then the screen is full screen.

 

 

<2>: for Nokia S40 mobile phones, such as 5300:

For system reasons, when you call platformRequest (String URL) to call the system browser for a single task, the program will respond in the background and call the system browser, but it will not be displayed, the browser will come out only when you exit your application (very depressing !)

 

Solution: Check the j2's API and find that platformRequest (String URL) returns a boolean value.

 

In this method, when true is returned, that is, the program needs to exit; false: the program does not need to exit; multi-task support

 

Then you can judge: boolean isExist = platformRequest (String Url)

When true is returned, our application is terminated to display the browser.

 

 

<3> continuous buttons for Nokia S40, such as 5300

When you switch from the advanced interface to the low-level interface, when you press "return" on the advanced interface, the "Return key" of the low-level interface is triggered"

 

Solution:

Define a boolean isKeyValide = false on the low-level interface;

In the showNotify () method, use a thread to pause for 300 milliseconds, and then change to isKeyValide = true;

 

Make a judgment in the keyPressed (int keyCode) Method

If (! IsKeyValide ){

Return;

}

 

If isKeyValide is set to false, no processing is performed. The result is returned directly !, This will solve the problem.

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.