07-23-2010 07:57 PM
Hello,
I'm trying to create a simple screen that has to images in it. To do this, I am creating a VerticalFieldManager (although to my understanding the screen itself acts as one) then adding bitmapfields to it on opposite corners. However, I find that only the first bitmap that I add to the screen is displayed. What's going on here? I know the images load properly because I have altered the order in which they appear, and it is always the case that only the first one added loads. Any help is appreciated. Here is my code:
public class MyScreen extends FullScreen {
public MyScreen() {
VerticalFieldManager _mainManager = new VerticalFieldManager();
_mainManager.setBackground(BackgroundFactory.crea
add(_mainManager);
BitmapField _bitmap;
Bitmap _mainmenutop;
Bitmap _cursor;
BitmapField _bitmap2;
_bitmap = null;
_bitmap2 = null;
_mainmenutop = Bitmap.getBitmapResource("mainmenutop.png");
_bitmap = new BitmapField(_mainmenutop, BitmapField.TOP
| BitmapField.RIGHT);
_cursor = Bitmap.getBitmapResource("cursor.png");
_bitmap2 = new BitmapField(_cursor, BitmapField.BOTTOM
| BitmapField.LEFT);
_mainManager.add(_bitmap);
_mainManager.add(new SeparatorField());
_mainManager.add(_bitmap2);
}
}
Solved! Go to Solution.
07-23-2010 08:13 PM
I just wonder if in fact the images are there, but because they are not focusable, the screen will not let you scroll to them. Add a NullField between the images and after the last one (or In fact any focusable Field not just a NullField) and see if that allows you to scroll and see you images.
07-23-2010 08:24 PM
Hi,
I tried your suggestion:
_mainManager.add(_bitmap);
_mainManager.add(new NullField());
_mainManager.add(_bitmap2);
_mainManager.add(new NullField());
But no luck. I also tried it with SeparatorFields and NullFields and no luck either.
-Juan
07-23-2010 09:54 PM
Can you try adding super(NO_VERTICAL_SCROLL) as the first line in your screen's constructor (right after public MyScreen() ) and tell us what you see?
07-23-2010 11:46 PM
Incredibly, the main problem is Field.TOP in your _bitmap!
I knew VerticalFieldManager did not work well with Field.TOP and Field.BOTTOM, but that was really unexpected. I wonder how many experts could predict that...
So remove Field.TOP from the style bits in your _bitmap and make sure you don't use VerticalFieldManager or Screen with VERTICAL_SCROLL (or Field.BOTTOM will send your field down to virtual infinity).
07-24-2010 03:18 PM
and if you were to make Peter's suggestion work for you, you'd want to try something like this
_mainManager.add(_bitmap);
_mainManager.add(new NullField(Field.Focusable));
_mainManager.add(_bitmap2);
_mainManager.add(new NullField(Field.Focusable));
07-24-2010 05:52 PM
Problem solved (removing TOP fixed it.) Thanks for all the help.