Tag: 黑莓

如何将图像添加到网格视图并为这些图像添加单击function?

public final class gridFieldDemoScreen extends MainScreen { LabelField one, two, three, four, five, six; public gridFieldDemoScreen() { setTitle(“gridFieldDemo”); GridFieldManager grid = new GridFieldManager(2, 3, 0); one = new LabelField(“ONE”); grid.insert(one, 0); two = new LabelField(“TWO”); grid.insert(two , 1); three = new LabelField(“THREE”); grid.insert(three, 2); four = new LabelField(“FOUR”); grid.insert(four, 3); five = new LabelField(“FIVE”); grid.insert(five, […]

使用Singleton共享变量

我一直很难理解如何使用单例来共享一个公共变量。 我正在尝试制作一个黑莓应用程序,它有两个入口点需要共享一个公共变量iconCount。 我被建议在论坛上使用带有RunTimeStore API的单例。 谷歌搜索最终导致: http://docs.blackberry.com/en/developers/deliverables/17952/CS_creating_a_singleton_by_using_rutnime_store_1554335_11.jsp 我在谷歌的几页深处,但我仍然无法理解它的作用以及如何实现它。 我目前的理解是,单身人士将通过代码以某种方式创建一个“全局变量”: class MySingleton { private static MySingleton _instance; private static final long GUID = 0xab4dd61c5d004c18L; // constructor MySingleton() {} public static MySingleton getInstance() { if (_instance == null) { _instance = (MySingleton)RuntimeStore.getRuntimeStore().get(GUID); if (_instance == null) { MySingleton singleton = new MySingleton(); RuntimeStore.getRuntimeStore().put(GUID, singleton); _instance = singleton; } […]

黑莓HTTP连接问题

我有一个简单的应用程序编写连接到Web服务(restful)。 该应用程序在黑莓模拟器上工作正常但是我在黑莓9300上使用它时遇到了问题。 当应用程序尝试调用Web服务时,我不断收到错误“java.io.ioexception:tunnel down”。 我正在调用的服务是一个简单的HTTPpost,我试图通过WIFI运行它(WIFI连接正常用于浏览互联网)。 我正在使用连接字符串“http://127.0.0.1:8080/test/restws;interface=wifi”,IP地址已更改为我正在呼叫的服务器的实际IP地址。 我可以在我的笔记本电脑浏览器上调用此服务器上的restful web服务。 我使用的代码类似于下面的&在模拟器上工作正常。 在模拟器和手机上的代码之间唯一改变的是连接字符串(使用“interface = wifi”与“deviceside = true”相反) 这是代码问题还是我需要在手机上更改的设置? 关于我需要做些什么才能克服这一点的想法。 谢谢 StreamConnection s = (StreamConnection) Connector .open(connectionString); httpConn = (HttpConnection) s; httpConn.setRequestMethod(“POST”); httpConn.setRequestProperty(“Content-Length”, Integer.toString(postData.length())); OutputStream output = httpConn.openOutputStream(); output.write(postData.getBytes()); output.flush(); output.close(); String response = httpConn.getResponseMessage(); int statusCode = httpConn.getResponseCode(); if (statusCode != HttpConnection.HTTP_OK) { } InputStream is = httpConn.openInputStream(); […]

适用于BlackBerry的良好LDAP库?

我正在寻找适合在BlackBerry上使用的优秀Java LDAP库。 在BlackBerry Java SDK中对LDAP有一些基本支持,但它太基础了,我想使用直接TCP连接而不是MDS(MDS是使用标准BB SDK中的LDAP类时唯一的传输选项)。 关于function我基本上想要搜索一些用户及其属性。 简单来说,我们可以假设我正在构建电话簿,但客户端只是从服务器读取条目,而不是添加任何内容。 如果在BlackBerry上没有可以运行的LDAP lib,那么Java库也可以工作,如果它不会太难移植… 感谢您的任何指示!

在启动时运行BlackBerry应用程序,并添加它在后台运行的通知

我想编写一个在启动时运行并在后台运行的Java BlackBerry应用程序,但是会向用户显示它在主屏幕的一角有一个图标运行。 我可以使用哪些技术?

如何检查数组中是否已存在元素

我正在从一个页面向另一个页面发送值,我想存储我发送的值,然后想要将我发送的值与我已经发送的值进行比较,即保存的值。同时存储值进入一个持久对象的数组,然后比较该值与另一个数组,我面临一些问题,任何人都可以告诉我如何检查一个值是否已经退出数组,我给的代码,亲切的帮助 package com.firstBooks.series.db; import java.util.Random; import net.rim.device.api.system.PersistentObject; import net.rim.device.api.system.PersistentStore; import net.rim.device.api.util.Arrays; import net.rim.device.api.util.Persistable; import com.firstBooks.series.db.parser.XMLParser; import com.firstBooks.series.ui.managers.TopManager; import com.firstBooks.series.ui.screens.TestScreen; public class DBMain implements Persistable{ public static String answer = “”; public static String selectedAnswer = “”; public static Question curQuestion; public static int currQuesNumber = 1; public static int correctAnswerCount = -1; static int curQuesnew; […]

J2ME – 使用javax.microedition.amms.control.camera.CameraControl; 是否可以禁用快门声音?

在我的Blackberry应用程序中,我已经实现了相机,并希望用我自己的替换默认的快门声音。 我想我可以通过使用方法enableShutterFeedback(false)然后播放我自己的声音来静音默认的摄像机声音,或者在激活摄像机之前立即播放我的声音。 private void initializeCamera() { try { // Create a player for the Blackberry’s camera Player player = Manager.createPlayer( “capture://video” ); // Set the player to the REALIZED state (see Player javadoc) player.realize(); // Grab the video control and set it to the current display _videoControl = (VideoControl)player.getControl( “VideoControl” ); if (_videoControl != null) […]

如何使用Adobe Reader Mobile SDK 9开发pdf / epub阅读器?

如何使用Adobe Reader Mobile SDK 9为黑莓设备开发pdf / epub阅读器? 如果您对Adobe Reader mobile SDK有任何了解,请帮助我。 谢谢。

Java中的套接字和进程

在Java中,最好的方法是打开一个持续监听的端口,并在收到数据包后仍然发送。 我目前对网络编程并不是特别精明,所以我在网上找到的教程并不是特别有用。 将侦听套接字作为serversocket并将其在一个单独的线程中运行到我用于将数据发送到服务器的套接字是否有意义? 在一个松散相关的问题。 有没有人知道如果编程只是为了java,在netbeans然后导出它用于黑莓(使用插件)套接字仍然可以工作?

如何关闭全局对话框并在BlackBerry中显示另一个对话框?

当谜语时间大于或等于4分钟时,我需要显示一个消息对话框。 如果空闲时间大于或等于5分钟,我需要关闭第一个对话框并按下另一个应该在5秒后自动关闭的对话框。 这是我到目前为止: public static RealtimeClockListener clockListenerTest = new RealtimeClockListener() { public void clockUpdated() { int _4Minutes = 60 * 4; int _5Minutes = 60 * 5; Dialog dialog4Minutes = new Dialog(“Stay Logged In?”, new String[] {“SI”, “NO”}, new int[]{1,2}, 2, null); dialog4Minutes.setDialogClosedListener(new DialogClosedListener() { public void dialogClosed(Dialog dialog, int choice) { //TODO } }); […]