Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2009

    Catching runtime exceptions

    hello, I'm writing an app which has gps functionalities but the latter will fail on phones like 6280. My aim is to ignore the exception and continue with other methods from my application but this seems daunting. Phone returns:

    No class def found Error java/lang/NoClassDefFoundError

    public String checkLocation()
            criteria = new Criteria();
            String string;
            try {
                locationProvider = LocationProvider.getInstance(criteria);
                location = locationProvider.getLocation(60);
            } catch (Exception e)
                //TODO: Handle exception.
                return "failed";
            coordinates = location.getQualifiedCoordinates();
            if (coordinates != null)
                // Use coordinate information
                double lat =  coordinates.getLatitude();
                double lon =  coordinates.getLongitude();
                string = "\nLatitude : " + lat + "\nLongitude : " + lon;
                return string;
                string = "failed";
                return string;
    I have an OK command which executes above method and appends returned string to the form. Any help would be highly appreciated.


  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Cheshire, UK

    Re: Catching runtime exceptions

    This falls under the category of "advanced techniques".

    Start by reading this document. It describes a technique for using any API that might not be present on the device.

    Is your application any use on devices without GPS? Unless you really, really want to run the application on non-GPS devices (like the 6280), I'd suggest you don't bother trying to handle this. It's another headache you don't need.


Similar Threads

  1. My App FIX IT thread
    By WildHeart in forum Mobile Java Tools & SDKs
    Replies: 24
    Last Post: 2009-12-26, 20:47
  2. Python runtime problem
    By anandnarayan891 in forum Symbian
    Replies: 3
    Last Post: 2009-11-05, 16:39
  3. Replies: 1
    Last Post: 2009-09-02, 16:03
  4. C++ exceptions VS Symbian Leaves :)
    By metalim in forum Symbian
    Replies: 18
    Last Post: 2009-04-15, 11:54
  5. Catching All Unhandled Exceptions from a single point
    By earamsey in forum Mobile Java General
    Replies: 2
    Last Post: 2007-07-20, 18:32

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts