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
Developer
Posts: 39
Registered: ‎06-23-2009
My Device: Storm 9530

RuntimeException

public WhereAreYouMainScreen() { super(MainScreen.NO_VERTICAL_SCROLLBAR); try { System.out.println("Attempting to create new GPS"); this.gps=new GPS(new AutonomousCriteria(),this); } catch (LocationException e) { Dialog.alert("Location Exception when getting gps object: "+e.getMessage()); close(); return; } System.out.println("Successfully created new GPS"); System.out.println("Attemting to add message listner..."); try { this.message=new MSG(this); } catch (IOException e) { //Dialog.alert("Error starting message listener!!"); } System.out.println("Successfully added message listener..."); System.out.println("Successfully started WHEREAREYOU"); this.contactManager=new ContactManager(); this.label=new LabelField("WhereAreYou", LabelField.FIELD_HCENTER | LabelField.HCENTER | LabelField.READONLY ); add(this.label); add(new SeparatorField()); map=new MapField(MapField.USE_ALL_WIDTH ); add(map); HorizontalFieldManager horo=new HorizontalFieldManager(HorizontalFieldManager.USE_ALL_WIDTH); map.setPreferredSize(Display.getWidth(), 4*(Display.getHeight()/5)); map.moveTo(new Coordinates(11.3567,-98.40792,0)); map.setZoom(15); this.currentLoc=new RichTextField("Waiting for GPS Fix...",RichTextField.FIELD_BOTTOM | RichTextField.USE_ALL_HEIGHT | RichTextField.USE_ALL_WIDTH | RichTextField.FIELD_HCENTER | RichTextField.TEXT_ALIGN_HCENTER); horo.add(this.currentLoc); add(horo); } public boolean onClose() { Dialog.alert("GoodBye"); this.contactManager.save(); this.message=null; this.contactManager=null; this.gps=null; return super.onClose(); }

 

Not an imminent error stopping me from doing anything but it is something i havent been able to figure out... i have an app that uses a message listener when i start the app for the first time everything works fine. i recieve my gps fixes and can see recieved text messages... however when i close my app and then try to run the app again i get a runtimeexception... the error seems to be coming from the line in which i notify the user that i cannot add a messagelistener as i do this by pushing out a dialog.alert screen when there is an IO error.... I am attatching some of my source... note i also override the onclose() of mainscreen but also return super.onclose() in my onclose()