我创建了一个ButtonField和一个BitmapField,比如..
public class MyCanvas extends MainScreen implements FieldChangeListener
{
HorizontalFieldManager hfm;
private Bitmap startBitmap;
private BitmapField startBitmapField;
private ButtonField okButton;
MyCanvas()
{
hfm = new HorizontalFIeldManager();
startBitmap = Bitmap.getBitmapResource("start.png");
startBitmapField = new BitmapField(startBitmap);
startBitmapField.setChangeListener(this);
hfm.add(startBitmapField);
okButton = new ButtonField("Ok", ButtonField.CONSUME_CLICK | ButtonField.NEVER_DIRTY);
okButton.setChangeListener(this);
hfm.add(okButton);
}
public void fieldChanged(Field field, int context)
{
if(field == startBitmapField)
{
System.out.println("Touched START...");
}
else if(field == okButton)
{
System.out.println("Touched Ok...");
}
}
}
Run Code Online (Sandbox Code Playgroud)
但ButtonField或BitmapField点击不会发生在Blackberry 4.7模拟器中.
我想为Blackberry Storm构建它,所以我使用的是Blackberry 4.7
如何为Blackberry Storm处理ButtonField和BitmapField的点击/触摸事件?
我正在创建ButtonField和BitmapFields
okButtonField = new …Run Code Online (Sandbox Code Playgroud) user-interface blackberry touchscreen blackberry-storm rim-4.7
我正在BlackBerry JDE 4.5中编写一个Java应用程序,它将在启动时开始侦听某些事件.我想在状态栏中显示一个小图标.
我知道它在带有ApplicationIcon,ApplicationIndicator和ApplicationIndicatorRegistry类的BlackBerry API版本4.6.0中的支持,但是在BlackBerry JDE 4.5.0 API集中有哪些类?
更新
我认为4.5.0有一些支持,因为我使用的是带有OS v4.5.0.81的Blackberry Pearl 8100,它在状态栏上显示任何传入消息或呼叫的通知图标.
我制作了Alternale入口点和主要CLDC应用程序,如下文所述,
我有一篇文章,
其中表示
无论应用程序是否正在运行,备用条目将使用传入的参数调用main方法.
但在我的情况下,当应用程序在后台运行时单击appIcon时,不会调用main().
它仅更新先前在备用入口点中设置的appIcon和appName.
所以如果在点击updatedIcon时没有调用main(),那么我没有得到控件的位置?
有人对这个问题有任何想法吗?
我更新了appIcon&appName.
现在我想要的是"当点击updatedIcon时,应该打开一个特定的屏幕,当用户返回主菜单时,应用程序应该获得其原始图标,应用程序名称和流量应该通过main()点击原始应用程序图标"
我在想,当我点击更新的appIcon时,控件将转到main(),但它没有调用main(),
Starting AppName
AppName already running
Run Code Online (Sandbox Code Playgroud)
&直接进入第一个屏幕.当我回到主菜单时,应用程序已更新图标和名称
那怎么弄呢?
我创建了一个HorizontalFieldManager并添加了BitmapFields.
在Blackberry Storm中,Display.getWidth()是480.在那里我想使用第一个450在屏幕的LHS处添加一些BitmapFields,我在运行时创建并在屏幕的RHS处添加2个BitmapFields.
我想在开始时显示的2个BimapFields在构造函数和其他BitmapFields中添加,我在运行时创建了r,后面添加了像..
class MyCanvas extends MainScreen
{
MyCanvas()
{
hfm_BitmapField = new HorizontalFieldManager(){
protected void sublayout(int maxWidth, int maxHeight) {
super.sublayout(maxWidth, maxHeight);
setExtent(Display.getWidth()-30, 60);
}
};
startBitmap = Bitmap.getBitmapResource("start.png");
startBitmapField = new BitmapField(startBitmap, BitmapField.ACTION_INVOKE | BitmapField.FIELD_HCENTER | BitmapField.FIELD_RIGHT);
hfm_BitmapField.add(startBitmapField);
endBitmap = Bitmap.getBitmapResource("end.png");
endBitmapField = new BitmapField(endBitmap, BitmapField.ACTION_INVOKE | BitmapField.FIELD_HCENTER | BitmapField.FIELD_RIGHT);
hfm_BitmapField.add(endBitmapField);
drawBitmap();
}
public void drawBitmap()
{
bitmap[i] = new Bitmap(50, 50);
Graphics g = new Graphics(bitmap[i]);
g.drawLine(5,5,25,25);
bitmapField[i] = new BitmapField(bitmap[i]);
synchronized(UiApplication.getEventLock()) { hfm.add(bitmapField[i]); }
} …Run Code Online (Sandbox Code Playgroud)