setExtent 导致 BlackBerry 9000 中未找到 ScrollView 错误

发布于 2024-11-04 00:06:18 字数 649 浏览 5 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

生生漫 2024-11-11 00:06:18

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 the ScrollView 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 a VerticalFieldManager it may use ScrollView. 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文