buttonField clicking problem in blackberry
Posted
by Master
on Stack Overflow
See other posts from Stack Overflow
or by Master
Published on 2010-03-21T13:17:00Z
Indexed on
2010/03/21
13:21 UTC
Read the original article
Hit count: 356
blackberry-simulator
hi
when i am setting the BackGround image through VerticalField Manager. only one buttonField is gettin clicked ,other button field is not working. can i have the solution for it. please if not i want alternative which will position the buttonfield ,set by user. and i want a image as a background
help me out. its urgent..
public GreetingsMainScreen()
{
homeBackgroundImage=Bitmap.getBitmapResource("com/greetings/Images/HomeBackgroundImage.jpg");
exitField=new ButtonField("Exit",ButtonField.CONSUME_CLICK);
exitField.setChangeListener(this);
greetField=new ButtonField("GREET",ButtonField.CONSUME_CLICK);
greetField.setChangeListener(this);
VerticalFieldManager manager = new VerticalFieldManager()
{
protected void sublayout(int width, int height)
{
width=fwidth;
height=fHeight;
super.sublayout(width,height);
setPositionChild(greetField, width-232, height-150);
setPositionChild(exitField, width-205, height-110);
setExtent(width, height);
}
};
manager.setBackground(BackgroundFactory.createBitmapBackground(homeBackgroundImage));
manager.add(exitField);
manager.add(greetField);
add(manager);
}
public void fieldChanged(Field field, int context) {
if(field == exitField)
{
Dialog.alert("Hi");
System.exit(0);
}
if(field == greetField)
{
System.exit(0);
}
}
}
Thanks alot
© Stack Overflow or respective owner