显示简单的HTML在本机黑莓应用 [英] Display simple HTML in a native BlackBerry application

查看:163
本文介绍了显示简单的HTML在本机黑莓应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能在我的家乡黑莓手机的应用程序,以显示HTML的一些简单的块,而不是从URL返回。这类似于现有的问题#1(例如这里和<一个href=\"http://stackoverflow.com/questions/1339384/displaying-html-content-in-a-field-in-blackberry\">here),但我需要帮忙的实际样品黑莓code运行(或者有人告诉我这是为什么注定不行!)。

I want to be able to display some simple chunks of HTML in my native BlackBerry app, NOT returned from a URL. This is similar to existing Stackoverflow questions (e.g. here and here), but I need help getting the actual BlackBerry sample code to run (or perhaps somebody to tell me why this is doomed to not work!).

黑莓网站提供了一些样品'浏览器'code基于可用不同的API版本:结果
<一href=\"http://docs.blackberry.com/en/developers/deliverables/11935/Display%5Fcontent%5Fin%5FBB%5FBrowser%5Ffield%5F565587%5F11.jsp\"相对=nofollow> V4.5 API样本结果
<一href=\"http://docs.blackberry.com/en/developers/deliverables/11935/Display%5FHTML%5Fin%5Fa%5Fbrowser%5Ffield%5F825639%5F11.jsp\"相对=nofollow> V5.0 API样本

The BlackBerry website has some sample 'browser' code based on different API versions available:
V4.5 API sample
V5.0 API sample

我发现样品code附带的组件包(更多信息<一个href=\"http://stackoverflow.com/questions/919126/blackberry-audio-recording-sample-$c$c/1877685#1877685\">here),并试图让V4.5样本code的工作。我希望这将是一个有用的起点......

I've found the sample code that ships with the Component Packs (more info here), and tried to get the V4.5 sample code to work. I was hoping this would be a useful starting point...

我设法BrowserFieldDemo在Eclipse编译并在模拟器中运行(我需要注释掉整个BrowserContentManagerDemo.java否则该类将改为运行)。

I've managed to get BrowserFieldDemo to compile in Eclipse and run in the Simulator (I needed to comment out the whole of BrowserContentManagerDemo.java otherwise that class would run instead).

不幸的是,我只是得到了模拟器白屏。当我在日志中添加和使用调试器,这一切似乎出问题的getBrowserContent()线在这里:

Unfortunately, I just get a white screen in the Simulator. When I add in logging and use the debugger, it all seems to go wrong at the getBrowserContent() line here:

BrowserContent browserContent = null;

try
{
    browserContent = _renderingSession.getBrowserContent(connection, this, e);
    <snip>
}
catch (RenderingException re)
{
  EventLogger.logEvent(ID, (re + "").getBytes(), EventLogger.ERROR);
  System.err.println(re);
}

返回的例外是:

net.rim.device.api.browser.field.RenderingException:IOException异常在连接

net.rim.device.api.browser.field.RenderingException: IOException in connection

我试过建设和使用与4.5.0和4.7.0组件包的模拟器,但它们都具有相同的症状。

I've tried building and using the Simulator with the 4.5.0 and 4.7.0 Component Packs, but they both have the same symptoms.

如果我推samples.cod文件到我的设备并启动它,我得到错误启动样本:模块'样品'尝试访问安全API。 presumably我需要签署样本code。与我的code签名密钥(这一点我有),这我不知道如何在Eclipse做的。

If I push the samples.cod file to my device and start it, I get "Error starting samples: Module 'samples' attempts to access a secure API". Presumably I would need to sign the sample code with my code signing keys (which I do have), which I am not sure how to do in Eclipse.

所以,我的问题是:

1)具有听谁说得到这个V4.5样本code的工作?我是否应该放弃对模拟器和使用的设备呢?

1) Has anybody actually got this V4.5 sample code working? Should I give up on the Simulator and use the device instead?

2)可用于显示一些简单的HTML数据这种做法V4.5的工作,我有吗?例如我可以使用本地主机URL,或者创建自定义的HttpConnection来提供数据?

2) Can this V4.5 approach work for displaying some simple HTML data that I have? e.g. can I use a localhost URL, or perhaps create a custom HttpConnection to serve up the data?

我要支持运行V4.5,V4.7和V5.0黑莓机型,如果在所有可能的。

I need to support BlackBerry models running V4.5, V4.7 and V5.0, if at all possible.

任何提示将AP preciated!

Any tips would be appreciated!

推荐答案

请确保您启动设备模拟器之前推出MDS模拟器。全部或大部分使用HTTP没有指定运输等都将使用默认的MDS运输,如果你没有那么MDS模拟器运行,则无法建立HTTP连接,这意味着样品。

Make sure that you launch the MDS simulator before launching the device simulator. All or most of the samples that use HTTP don't specify a transport and so will use the default MDS transport, which means if you don't have MDS simulator running then it won't be able to make an HTTP connection.

这篇关于显示简单的HTML在本机黑莓应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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