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 Contributor
bleformet
Posts: 2
Registered: ‎06-22-2011
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);
        setTitle("Mapas");
        Criteria myCriteria = new Criteria();
        myCriteria.setCostAllowed(false);     
        try {
            LocationProvider myLocationProvider =LocationProvider.getInstance(myCriteria);
            try {
                Location myLocation = myLocationProvider.getLocation(300);
                _latitud=myLocation.getQualifiedCoordinates().getLatitude();
                _longitud=myLocation.getQualifiedCoordinates().getLongitude();
                String a = Double.toString(_latitud);
                String b = Double.toString(_longitud);
                add(new RichTextField(a+b));
               
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        } catch (LocationException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
       
       
        MapsArguments ma = new MapsArguments(MapsArguments.ARG_LOCAL_SEARCH,"Bank, Scotiabank ", "4328915,-8032480");
        Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, ma);

    }
 }

Please use plain text.
Administrator
MSohm
Posts: 14,060
Registered: ‎07-09-2008
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.
Found a bug? Report it using Issue Tracker
Please use plain text.