MIDP 2.0版本问题:$ type未为$ type定义 [英] MIDP 2.0 version issues: $method is undefined for $type

查看:124
本文介绍了MIDP 2.0版本问题:$ type未为$ type定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个MIDlet,它可以完成几项高级"操作:从Web上获取图像,调整图像大小,将其保存在手机上,显示它们.

I've written a MIDlet that does several "advanced" things: fetching images from the web, resizing them, saving them on the phone, displaying them.

这一切在诺基亚S60第三版FP1仿真器中均可完美运行.该设备具有MIDP 2.0和CLDC 1.1支持(还有JSR75,我需要它才能保存文件).它也可以在诺基亚E71(物理设备)上正常工作.

This all works perfectly in the Nokia S60 3rd Edition FP1 emulator. This device has MIDP 2.0 and CLDC 1.1 support (also JSR75, which I need in order to save files). It also works as it should on the Nokia E71 (physical device).

然后,我尝试在其他几个模拟器上运行MIDlet.其中之一,来自Java ME SDK 3.0的DefaultCldcJtwiPhone2,也声称支持MIDP 2.0和CLDC 1.1.它没有JSR75,这说明了为什么无法将FileConnection解析为类型".

I then tried to run the MIDlet on several other emulators. One of them, the DefaultCldcJtwiPhone2 from the Java ME SDK 3.0, also claims MIDP 2.0 and CLDC 1.1 support. It doesn't have JSR75, which explains why "FileConnection can not be resolved to a type".

但是,这并不能解释为什么未定义List.deleteAll(),String.equalsIgnoreCase(String)以及其他一些原因.

This does not, however, explain why List.deleteAll(), String.equalsIgnoreCase(String) and a few others are undefined.

我得到的实际错误:

  • 未为Math类型定义方法ceil(double)
  • 未为List类型定义方法deleteAll()
  • 对于类型String,未定义equalsIgnoreCase(String)方法
  • 对于Displayable类型,未定义方法getWidth()

当我查看MIDP 2.0(即JSR118)API( http://java.sun.com/javame/reference/apis/jsr118/),我可以清楚地看到所有这些方法,其中因为"标记是MIDP 2.0或CLDC 1.1.

When I look at the MIDP 2.0 (i.e. JSR118) API (http://java.sun.com/javame/reference/apis/jsr118/), I can clearly see all of these methods being present, with the "since" tag being either MIDP 2.0 or CLDC 1.1.

我的问题:为什么没有MIDP 2.0支持的仿真器可以访问所有MIDP 2.0方法?或者,我在做什么错了?

My question: why doesn't an emulator with MIDP 2.0 support have access to all MIDP 2.0 methods? Or alternatively, what am I doing wrong?

推荐答案

听起来像您在使用CLDC 1.1中定义的方法;您正在使用的仿真器必须仅支持CLDC 1.0(这肯定可以解释为什么缺少equalsIgnoreCase()以及涉及到doublefloat原语的任何内容).请在此处中查看完整的API.有关1.0之间的差异列表,请参见此处.和1.1.

Sounds like you're using methods defined in CLDC 1.1; the emulator you are using must only support CLDC 1.0 (this would certainly explain the lack of equalsIgnoreCase() and anything involving double and float primitives). See the full API here. And see here for a list of differences between 1.0 and 1.1.

检查设备的CLDC版本的一些方法:

Some ways to check the CLDC version of your device:

1)按照此处.

System.out.println("The CLDC version is:  " + System.getProperty("microedition.configuration"));

2)检查是否存在仅受1.1支持的类.

2) Check the existence of a class supported only in 1.1.

try {
    Class.forName("java.lang.ref.WeakReference");
    System.out.println("It's CLDC 1.1");
} catch (ClassNotFoundException e) {
    System.out.println("It's CLDC 1.0");
}

这篇关于MIDP 2.0版本问题:$ type未为$ type定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆