setExtent 导致 BlackBerry 9000 中未找到 ScrollView 错误
这
import net.rim.device.api.ui.container.VerticalFieldManager;
public class FixedHeightVerticalFieldManager extends VerticalFieldManager
{
private int height;
public FixedHeightVerticalFieldManager(int height)
{
super();
this.height = height;
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(maxWidth, height);
setExtent(height);
}
}
会导致模拟器挂起并出现运行时异常 net.rim.device.api.ui.ScrollView not found
。好像是调用setExtent
引起的,setExtent是继承自Field
的方法VerticalFieldManager
,模拟器在4.6的API中设置好即可使用。为什么? ScrollView 有什么关系呢?
This--
import net.rim.device.api.ui.container.VerticalFieldManager;
public class FixedHeightVerticalFieldManager extends VerticalFieldManager
{
private int height;
public FixedHeightVerticalFieldManager(int height)
{
super();
this.height = height;
}
protected void sublayout(int maxWidth, int maxHeight)
{
super.sublayout(maxWidth, height);
setExtent(height);
}
}
--causes the emulator to hang with the runtime exception net.rim.device.api.ui.ScrollView not found
. It seems to be caused by the call to setExtent
, which is a method VerticalFieldManager
inherited from Field
, which is in the 4.6 API that the emulator is set up to use. Why? What does ScrollView have to do with anything?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
net.rim.device.api.ui.ScrollView
在 4.6 API 中不可用 - 这就是原因。因此,我怀疑您在尝试在 4.6 操作系统模拟器上运行时在代码中的某个位置使用了 ScrollView。另外,构建项目时使用的是哪个 API 版本?通常(如果您使用 4.6 API lib/JDE),您应该在构建步骤(相对于运行时)遇到此错误。
更新:
我真的不知道为什么这与
setExtent()
有关。我怀疑您很可能使用 API 6 进行编译。对于 API 6,继承链看起来为
Field
>ScrollView
> >经理
>VerticalFieldManager
,因此当您编译VerticalFieldManager
时,它可能会使用ScrollView
。也许这就是您在 API 4.6 模拟器上收到错误的原因。您可以通过尝试在任何 OS 6.0 模拟器上运行您的应用程序来测试这个想法。我相信它不应该给出这个错误。PS我没有太多使用BB Eclipse插件(曾经尝试过,但后来因为一些问题而拒绝),所以我不能说到底在哪里检查API版本。但肯定有一种方法可以检查这一点。
net.rim.device.api.ui.ScrollView
is not available in 4.6 API - that's the reason. So I suspect you're using theScrollView
somewhere in your code while you are trying to run on a 4.6 OS simulator.Also what API version is used to build the project? Normally (if you'd use 4.6 API lib/JDE) you should have got this error at building step (versus in runtime).
UPDATE:
I really have no idea why this is related to
setExtent()
.I suspect most likely you compile using API 6. For API 6 the inheritance chain looks as
Field
>ScrollView
>Manager
>VerticalFieldManager
, so when you compile aVerticalFieldManager
it may useScrollView
. Maybe that's why you get the error on API 4.6 simulator. You can test this idea by trying to run your app on any OS 6.0 simulator. I believe it should not give this error.P.S. I have not used BB Eclipse plugin much (once I tried, but then refused because of some issues), so I can't say where exactly to check the API version. However surely there must be a way to check that.