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

New Contributor
Posts: 2
Registered: ‎06-22-2011
My Device: Storm 2 9559
My Carrier: Unefon

Local Search Whit my position like parameter

Hi  good day.

I have a proble. a very hard problem.

We need make a local search but in location i need send my location.

I create a little code. but my application show me the next error JVM Error 104 Uncaught:Controlled Access Exception

and This is my code.


package mypackage;

import net.rim.blackberry.api.invoke.Invoke;
import net.rim.blackberry.api.invoke.MapsArguments;
import net.rim.device.api.ui.component.RichTextField;
import net.rim.device.api.ui.container.MainScreen;
import javax.microedition.location.*;

public class handleGPS extends MainScreen{
    double _latitud;
    double _longitud;
    public handleGPS(){
        super(MainScreen.VERTICAL_SCROLL | MainScreen.VERTICAL_SCROLLBAR);
        Criteria myCriteria = new Criteria();
        try {
            LocationProvider myLocationProvider =LocationProvider.getInstance(myCriteria);
            try {
                Location myLocation = myLocationProvider.getLocation(300);
                String a = Double.toString(_latitud);
                String b = Double.toString(_longitud);
                add(new RichTextField(a+b));
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
        } catch (LocationException e) {
            // TODO Auto-generated catch block
        MapsArguments ma = new MapsArguments(MapsArguments.ARG_LOCAL_SEARCH,"Bank, Scotiabank ", "4328915,-8032480");
        Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, ma);


BlackBerry Development Advisor
Posts: 15,852
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Local Search Whit my position like parameter

Note that obtain GPS coordinates is a blocking operation that should not be performed on the main event thread.  You should move your code that polls for GPS coordinates to its own thread.


Ensure that your application has the appropriate permissions required.  You can use the ApplicationsPermissions APIs or configure this manually by going to Options, Applications selecting your application and choosing Edit Permissions from the menu.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.