“CMCC-Motorola Cup” J2ME Contest Technical FAQ of Motorola
J2ME Q&A -Device
388c
Q:388c和J2ME开发相关的基本参数?
A:
CLDC 1.0 and MIDP 1.0 compliant
Amount of storage for MIDlets -----------up to 2.7Mb
Java runtime memory ----------------------------- 2.5Mb.
Recommended Maximum MIDlet suite size ------- 1Mb.
Maximum Record Store size ----------------------100 Kb.
Display available to MIDlets ---------------- 240x 276.
Color --------------------------------------------------64K
Connection Interfaces------------HTTP, Socket, UDP, Serial port.
Maximum persistent connections---------------------- 4.
Supported image formats ---------------------------PNG.
Double Buffering ----------------------------- Supported.
Encoding Schemes ------------ ISO8859_1, ISO10646.
PNG Transparency ----------------------------Supported.
J2ME™ LWT support-------------------------Supported
T720
Q:T720和J2ME开发相关的基本参数?
A:
CLDC 1.0 and MIDP 1.0 compliant
Amount of storage for MIDlets -----------up to 1.0Mb (640K application+415K data).
Java runtime memory ----------------------------- 512Kb.
Recommended Maximum MIDlet suite size ------------- 200Kb.
Maximum Record Store size ----------------------63 Kb.
Display available to MIDlets ---------------- 120 x 160.
Color --------------------------------------------------4K
Connection Interfaces------------HTTP, Sockets, UDP.
Maximum number of sockets -------------------------- 3.
Supported image formats ---------------------------PNG.
Double Buffering ----------------------------- Supported.
Encoding Schemes ------------ ISO8859_1, ISO10646.
PNG Transparency ----------------------------Supported.
J2ME™ LWT support-------------------------Supported
388
Q:388和J2ME开发相关的基本参数?
A:
CLDC 1.0 and MIDP 1.0 compliant
Amount of storage for MIDlets -----------up to 1.4Mb
Java runtime memory ----------------------------- 700Kb.
Recommended Maximum MIDlet suite size --- 200Kb.
Maximum Record Store size ----------------------100 Kb.
Display available to MIDlets ---------------- 240x 276.
Color --------------------------------------------------4-level grayscale
Connection Interfaces------------HTTP, Socket, UDP, Serial port.
Maximum persistent connections---------------------- 4.
Supported image formats ---------------------------PNG.
Double Buffering ----------------------------- Unsupported.
Encoding Schemes ------------ Unicode, ISO8859_1, ISO10646, UTF-8.
PNG Transparency ----------------------------Supported.
J2ME™ LWT support-------------------------Supported
V60i
Q:V60i和J2ME开发相关的基本参数?
A:
CLDC 1.0 and MIDP 1.0 compliant
Amount of storage for MIDlets ---------------up to 1Mb (768K application +243Kb data)
Java runtime memory ----------------------------- 350Kb.
Recommended Maximum MIDlet suite si------- 50Kb.
Maximum Record Store size ----------------------100 Kb.
Display available to MIDlets ---------------- 96x 64.
Color --------------------------------------------------Black/White
Connection Interfaces--------------------------HTTP, Socket
Maximum persistent connections---------------------- 3.
Supported image formats ---------------------------PNG.
Double Buffering ----------------------------- Supported.
Encoding Schemes ------------ ISO8859_1, ISO10646.
PNG Transparency ----------------------------Supported.
J2ME™ LWT support-------------------------Supported
J2ME Q&A -SDK/IDE
1. Q: Where can I download Motorola SDK for J2ME?
A: You can go to the following link to download 90 days trial version Metroerks Codewarrior IDE for Java from CMCC Java Contest web site or from below web site. The Motorola SDK will in the directory: C:\ProgramFiles\Metrowerks\CodeWarrior\Java_Support\MotoSDK
http://developers.motorola.com/developers/wireless/tools/
2. Q: Is it possible to code a voice recorder and storing program using J2ME? Looking over MIDP, I find such functionality (voice input) does not exist. Does Motorola have a device specifice classes?
A: The os of Motorola Java enabled devices such as A388 runs standard CLDC/MIDP. The only extended classes we provided now is LWT (light Weight Toolkit) which utilizes User Interface. Currently we don't have a device specifise classes on voice.
3. Q: I've downloaded LWT you provide for developing J2ME programs, and put LWT.zip in the derectory of lib/ for Sun's J2ME wireless toolkit. However, when I run the program, I can't see how the program will run on the Motorola's mobile phone but only some texts in the console window.
A: The LWT development tools provided here contain the class files and documentation needed to develop J2ME applications that use these features on LWT-enabled devices such as the Accompli 388. These tools do not allow LWT to be added to devices that do not already support it.
When you add LWT classes to a tool, it doesn't mean you are adding an emuloator for Motorola LWT enabled phone. If you want to simmulate your applications in an Motorola phone such as A388 emulator, you can use Metrowerks CodeWarrior IDE, which you can download 30 days trial version from the following link, it contains A388 emulator.
http://developers.motorola.com/developers/wireless/tools/
4. Q: I have set up an OTA-server (based on win2000, orion) and are downloading MIDlets to an Accompli 388. It works fine for all but one of the MIDlets I have tested, of course that's the one we need to be able to download... For this MIDlet the JAD file are downloaded and the information displayed on the phone. When I thereafter accept to download the JAR it responds 'Invalid OTA Server' and aborts. This MIDlet is possible to download via cable and the only difference that I can see from the others is that this is bigger (size of JAR is 70KB). Could that be a problem? Any other ideas?
A: There may be two factors that cause your installation failed:
1. The most files you can install in A388 is about 200 files. When you exceed this number, your installation will fail.
2. The size of the jar file, we recommend not to exceed 100KB. If you downloaded a compressed jar file, it will decompress into much bigger file when you install it.
So when you download midlet to A388, please keep in mind about the file number and jar file size. For your situation, it is hard to say if the failure is because of the jar size. You may test it out using infrared installation instead.
100 KB is a recommended size. It is hard to say what jar size is the exactly limit. Normally 20-30 KB is good for installation on phone devices. If the file can be download through cable, the size should be OK.
5. Q: Is there any way to access the voice notes recordings using J2ME calls? In other words, can one write a J2ME program that accesss voice notes recordings and use them as the developer see fit (ex. sending them over to the net using https)? How about using VoiceXML? If not, is there any other way to send the voice data to the internet?
A: To my knowledge, There is no way to write an J2ME application to access/store voice notes.
6. Q: I am writing a J2ME program which try to display some images on the Accompli 6288 phone. When I conduct the testing and use the images(PNG format) from the demo programs provided by Sun Microsystem, it can display without any problem. However, when I replace the image with the one(also PNG format) produced by Photoshop, it cannot be display. I choose a JPEG image and saved it as PNG format. Does the J2ME in A6288 just handle a part of the PNG encoding?
A: A6288 supports 4 level Gray scale. You can use the numColors() method to determine the number of colors on your device. Attempting to use color images on a grayscale device will greatly increase memory use, and significantly decrease performance.
7. Q: Does J2ME for A6288 support socket, because I found it from the specification. If A6288 supports socket, in what way I can use it. Can you rovide me some samples?
A: A6288 supports socket.
Here is an example:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;
public class socketConn extends MIDlet implements CommandListener, Runnable {
private int state;
private static final int STATE_SEND = 1;
private static final int STATE_READ = 2;
private Display display=null;
String url = "socket://Your Server IP Address:Your Server Port";
private Thread thread =null;
StreamConnection c ;
InputStream is = null;
OutputStream os = null;
TextBox oTextBox;
Command sendCommand = new Command("Send",Command.SCREEN, 1);
Command readCommand = new Command("Read",Command.SCREEN, 1);
public socketConn()
{
super();
System.out.println("Inside Midlet Constructor...");
display = Display.getDisplay(this);
}
public void connect(){
try{
System.out.println("Making socket Connection ...");
c = (StreamConnection)Connector.open(url);
is = c.openInputStream();
os = c.openOutputStream();
}catch(ConnectionNotFoundException e){
System.out.prin...
8. Q: Can you confirm this for me and direct me to a copy of the OTA Provisioning Specifation for the Accompli 388.
A: Motorola Acommpli 388/6288 is the device supports OTA. Here is the link the OTA spec. documentation:
http://developers.motorola.com/developers/wireless/global/uk/other/OTA.pdf
9. Q: I heard that Motorola's J2ME MIDP provides implementation for the StreamConnectionNotifier and StreamConnection Interface. If so, where can I download Motorola's J2ME implementation?
A: The functions you are asking about are available in all J2ME CLDC/MIDP certified implementations including Motorolas. The functions can be found in the CLDC specification. StreamConnection is defined in javax.microedition.io.StreamConnection.
We have been providing our J2ME implementation to Metrowerks for integration into CodeWarrior. I believe it is available in CodeWarrior 6.0 and up.
Please visit our website for wireless information:
http://developers.motorola.com/developers/wireless/
10. Q: how to transfer these data to a PC-application (e.g. for printing). The builtin applications (calendar etc.) do this by synchronizing with the TrueSync software on a PC, but how can we achieve this from inside a MIDP- application?
A: There is no way to transfer RMS data from phone to a PC.
For our GSM j2me enabled phone Accompli 388/6288, you can download j2me app. to the phone via IrDA, data cable, or OTA (Over The Air) download. If you want to download j2me app. via IrDA and data cable, you must have TrueSync software installed on your PC first, the TrueSync software comes with
the phone. For OTA download, you can type in the URL of a midlet and download it to the phone. An Installation screen will be shown after the download has been completed, you can then install it by following the screen instructions.
11. Q: We cannot get HttpConnection to work from a MIDP application on the Accompli 388. Network access is via GPRS. MIDlet runs fine and connects from any MIDP emulator. GPRS connection is also working fine from WML browser. The application just hangs on the device when it tries to make the connection. Also have tried reducing the size of data to be downloaded to only a few bytes but to no avail.
A: The Http connection runs slow on A388. Try a URL that doesn't have too much contents that will make it faster to retrieve information. Even with that it still takes several minutes. You also can try using CSD to connect instead of using GPRS. This way you can figure out if it is because the GPRS network traffic slows down the connection.
Please visit our website for wireless information:
http://developers.motorola.com/developers/wireless/
12. Q: I'm trying to install a midlet than I'm developing on a Accompli A388, and after downloading it I always get the same error message: Instalation failed. That midlet works perfectly in several simulators as well as MIDP for Palm devices. I downloaded others midlets that I have developed in the A388 and all of them work perfectly. Could you tell me what can I do? Where is the error? in the pplication manager? in my midlet? what exaclty?
A: First, I recommend you to check your manifest file. Sometimes even missing a carriage return will cause the installation failure. If you are sure about your manifest file, keep in mind for two restrictions for A388: First restriction will be the size of the app you try to install and the second is a restriction imposed by Motorola - the Accompli can
only hold about 200 files (according to their tech-support). Thus if you have a lot of files already installed on the phone and then download an application which increases the overall file number to over 200, you'll get an "Installation failure".
If the jar file size is too big, it will also cause installation failure.
The Midlet may run perfectly in all kind of emulators. But the real devices has memory and speed limitation. That's why for these kind of limited devices, we need to keep the jar size as small as possible.
13. Q: I am developing a midlet and currently testing on an Accompli 388 and Nokia 9210. The Nokia 9210 is able to provide a console where System.outs can be displayed however the Accomplia 388 does not provide such functionality - or does but I just haven't found it. Could you please direct me to the methods in debugging midlets with the Accomplei 388.
A:Accompli 388 doesn't have the functionality for System.out. That will need yourself to write some code in your program if you want to show some debugging information. You can pass the error message to a StringItem then post it on the screen (i.e. Form).
14. Q: is there any way to force the Accompli to use an external modem/network connection instead of making phone calls as we are trying to debug an Internet midlet and it is rather costly and inconvenient.
A: There is no way to force Accompli 388 to use an external modem/network connection. If you are trying to debug an internet midlet, should you really have to load it on the device (you can use some tools i.e. Codewarrior IDE to debug first). Or you can choose GPRS as your network connection as long as the operator provide this service because GPRS connection service charges you by the amount of data transferred (how many bytes) instead of counting how long you've spent online.
J2ME Q&A -Programming
Q:388c是不是只有24×24的汉字可以使用呢?这么大的字体给好的界面设计带来很大的障碍,大家有知道是否可以调用小字体吗?
A:388c对汉字只支持24×24,英文可以是24×24和24×12。如果想使用小字体需要自己画成图,作资源文件使用。
Q:388c的尺寸是240*276,可是我放一个240*240的图形后,屏幕就自动给我加上了垂直的滚动条,不知何原因?
A:270*276是包含了下面“确定”和“取消”按钮的大小。所以240×240的图片一屏显示不下。
Q:问一下createImage()对PNG文件的要求。
A:要求图片格式为png1.0。
Q:请问388c, T720支持透明格式的PNG吗?
A:支持。
Q:388c模拟器屏幕的比例和真机是一样的吗
A:在计算机上显示的388c屏幕要比真机略大一点。
Q: 388c上中文默认的编码是什么?
A:388c上显示的中文都是unicode编码格式的,另外,也可以接受以下三种中文格式:ISO10646,ISO8859_1,和UTF-8。
Q:我想用FONTMAKER做自定义字体,但MIDP的DOC中好象说不能自定义字体,是吗?
A:是的
Q:T720, 388c手机对声音支持如何?
A:T720中的KJAVA平台不支持声音,只有单音(警告音)。388c中有支持声音的扩展API,可以播放iMelody和GPRT格式的声音。
Q:用388c采集和显示数据,可行吗?
A:用串口可以实现数据的采集和显示。
Q:在388c的RAM里面最多一次可以多少K的程序?
A:640k
Q:请问T720和388c有没有针对游戏的优化?例如系统实现双缓冲?
A:有,它们都支持双缓冲。
Q:java语言在字符串里插入换行符是不是\n?"jsljg\nsdlgjfd"这么写可以吗?我想在textfield里实现分行显示。
A:用“字符串1”+“\n”+“字符串2”或者“字符串1”+“\r”+“字符串2”可以实现字符串换行。
Q:如何显示很长的字符串?
A:由于字体较大,并且用户不能自定义字体,使得长字符串比较麻烦。如果一行显示不下,可以分多行显示,在Canvas中用DrawString函数来实现。
Q:如何生成随机数?
A:用下面的方法即可:
Random r1=new Random();
int ib=r1.nextInt();
Q:能在CANVAS中加入一个TEXTFIELD/TEXTBOX吗?
A:和Canvas中不能加Button的道理一样,不可以在Canvas中添加TextField或者TextBox。
Q:我想在CANVAS中任意添加可以接收外界CLICK响应的控件,不是BUTTON也可以。就像在屏幕上的String也可以点击一样,是否可以实现?
A:CANVAS是一个低级控件,你应当选一个更高级的控件比如说Form,CANVAS只能接受KEY和pointer消息,你可以重写一个CLASS继承CANVAS,你将CANVAS的pointerPressed函数重新写一下就能够处理
Q:我想在SCREEN中任意位置加入Command.OK,可不可以实现,好像直接用addCommand(new Command("3",Command.OK,0))不可以定位呀,或者有什么其它方法实现?
A:在Form中添加Command按钮,只能放在底端固定的位置,这一点是不能改变的。如果要让位置灵活,要在Canvas中自己画出指定位置,制定大小的按钮,这时不能用CommandListener来响应,必须通过KEY 或PointerPressed函数来响应用户动作,并且执行相关操作。
Q:请问在一个界面的下部分可以定义三个Command吗?还有我可以用界面中最下面的空间吗?
A:屏幕最下边只能定义2个COMMAND。
Q:我现在想要显示大图片,但恐怕内存不够。我看了ImmuTableImage的原码,但decode函数是native的。所以我想是否可以看一下这一段虚拟机的代码,或者你可以告诉我图片大小要是空闲内存的百分之多少,图片才能正常的创建和显示?
A:虚拟机的代码无法看到。图片大小占空闲内存的比例也不能知道。图片多了,程序执行的速度会慢下来,你必须自己尝试。
Q:要是把所有的图片等都集成在代码中,有效率上的影响么?
A:图片还是作为资源文件的好
Q:不知道在TextArea中的setFont(Font font)是怎么设置字体,我看了一下Font的类,说什么它不能构造一个类,不知道是怎么设置!
A:在J2ME中,象TextField这样的高层UI API,不允许用户设定字体,这是由设备制造商设定好的。
Q:中文显示问题。如下代码中,
c = (HttpConnection)Connector.open(getURL);
InputStream inStream = c.openInputStream();
int ch = 0;
while ((ch= inStream.read()) != -1)
{
b.append((char)ch);
}
inStream.close();
c.close();
t = new TextBox("Http Text", b.toString(), 1024, 0);
运行结果在TextBox中不能正确的显示中文(getURL指向的页面中有中文字符),但是如果加上System.out.println(b.toString());,在控制台下显示的是正确的中文。
A:请使用InputStreamReader,可以解决中文显示的乱码问题。
Q:我想读取已经保存的数据,怎样的读取?但我用getRecordStore(int ID);没用的啊,只输出几个字符,该怎么办?
A:建议采用如下的方法。
byte[] getRecord(int recordId)
Returns a copy of the data stored in the given record.
int getRecord(int recordId, byte[] buffer, int offset)
Returns the data stored in the given record
Q:我的程序需要用用户名和密码控制,想使用网络数据源,请问如何实现?
A:服务器端应该是http server,建议使用Servlet/jsp技术实现。 其中的结构必然是标准的三层结构,前面是J2me client,中间是 JSP/Servlet, 通过JDBC连接数据库后面的DB,如果不考虑client端的j2me结构,后台实际上就是一个web site.
Q:有没有什么api直接将我的rms数据库,传到我自己的计算机上
A:388c可以通过串口操作,将RMS数据库的内容传到计算机中
Q:我准备在发送http post请求之前显示一个请等待的FORM页面,但就是没有显示,一定要等我的HTTP请求完成后才显示出来,为什么呢?这些操作是放在COMMAND的事件监听中的。
A:应该用另外一个线程去处理显示等待Form。
Q:j2me是否可以读取ZIP文件?
A:不可以。
本文地址:http://com.8s8s.com/it/it18034.htm