Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Member
raoravik
Posts: 1
Registered: ‎04-02-2011
My Device: 9800
My Carrier: Airtel

Displaying MapField inside the application throws IllegalArgumentException Bitmap is too large exception

 

I'm trying to add a map field in my blackberry application, but I get an exception on navigating to that screen saying IllegalArgumentException(Bitmap is too large). Any Idea?
Code:
    package com.quadrazol.bb.fpg.screens.maps;
    
    import net.rim.device.api.lbs.maps.ui.MapField;
    import net.rim.device.api.lbs.maps.model.MapDataModel;
    import net.rim.device.api.lbs.maps.model.MapLocation;
    import net.rim.device.api.lbs.maps.model.Mappable;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Color;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.component.SeparatorField;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    import com.quadrazol.bb.fpg.screens.TabScreen;
    import com.quadrazol.bb.fpg.util.DataHelper;
    import com.quadrazol.bb.fpg.util.UIHelper;
    
    public class FindAPlannerScreen extends TabScreen {
    
    private MapField basicMapField;
    
    public FindAPlannerScreen() {
    super();
    VerticalFieldManager mgr = new VerticalFieldManager(
    VerticalFieldManager.USE_ALL_HEIGHT
    | VerticalFieldManager.USE_ALL_WIDTH
    | VerticalFieldManager.NO_VERTICAL_SCROLL) {
    public void paint(Graphics graphics) {
    graphics.setBackgroundColor(Color.BLACK);
    graphics.clear();
    super.paint(graphics);
    }
    };
    add(mgr);
    mgr.add(UIHelper.generateHeader());
    mgr.add(new SeparatorField() {
    public void paint(Graphics graphics) {
    graphics.setColor(Color.WHITE);
    super.paint(graphics);
    }
    
    });
    
    VerticalFieldManager mainScrollView = UIHelper.generateMainScrollView();
    basicMapField = new MapField(mainScrollView.getWidth()-6,(int) (mainScrollView.getHeight()*.90));
    MapDataModel model = basicMapField.getModel();
    Mappable[] plannerDetails = DataHelper.fetchPlannerDetails();
    if (plannerDetails != null) {
    model.addAll(plannerDetails);
    }
    
    mainScrollView.add(basicMapField);
    mgr.add(mainScrollView);
    
    mgr.add(UIHelper.generateTabBarForScreen(UIHelper.TAB_MAP));
    }
    }
Exception:
    [0.0] ViewEngine$RenderingEngine:unknown exception occured, IllegalArgumentException(Bitmap is too large)
    [0.0] IllegalArgumentException
    [0.0] Bitmap is too large
    [0.0] net_rim_cldc-10(4C48DD41)
    [0.0]  Bitmap
    [0.0]  <init>
    [0.0]  0x8778
    [0.0] net_rim_cldc-10(4C48DD41)
    [0.0]  Bitmap
    [0.0]  <init>
    [0.0]  0x8628
    [0.0] net_rim_cldc-10(4C48DD41)
    [0.0]  Bitmap
    [0.0]  <init>
    [0.0]  0x8609
    [0.0] net_rim_cldc-10(4C48DD41)
    [0.0]  Bitmap
    [0.0]  <init>
    [0.0]  0x85ED
    [0.0] net_rim_cldc-10(4C48DD41)
    [0.0]  Bitmap
    [0.0]  <init>
    [0.0]  0x859E
    [0.0] net_rim_bb_maps_api-4(4C48E231)
    [0.0]  ViewEngine
    [0.0]  generateContext
    [0.0]  0x6457
    [0.0] net_rim_bb_maps_api-4(4C48E231)
    [0.0]  ViewEngine$RenderingEngine
    [0.0]  <private>
    [0.0]  0x65F2
    [0.0] net_rim_bb_maps_api-4(4C48E231)
    [0.0]  ViewEngine$RenderingEngine
    [0.0]  run
    [0.0]  0x6507
'I'm also confused between usage of `net.rim.device.api.lbs.maps.ui.MapField` and `net.rim.device.api.lbs.MapField`
I also tried setting it to half of the Display dimensions, but still it is throwing the same error. I noticed one strange thing. The updated code is as follows:
    int displayWidth = Display.getWidth();
    int displayHeight = Display.getHeight();
    basicMapField = new MapField(displayWidth / 2, displayHeight / 2);
    System.out.println("Display Dimen:"+displayHeight+" "+displayWidth);
    System.out.println("Map Dimen:"+basicMapField.getHeight()+" "+basicMapField.getWidth());
 But in logs I dont see the parameters set. The logs shows:
    [0.0] Display Dimen:480 360
    [0.0] Map Dimen:0 0
Values are not set in the object.

 

Please use plain text.