We help IT Professionals succeed at work.

unable to call method from class in package

blossompark
blossompark asked
on

Hi,
I'm trying to create a method in a class (code snippet 709402) which creates an instance of another class in the same package and then calls a method of the newly created class instance ...
however it will not compile....error says "package l does not exist" and " <identifier> expected" when i rollover   "l.listenLocate();"

the code for the called class is snippet 709419

any help appreciated ...thanks
package taxiConsoleV6_beta;

import javax.microedition.location.*;

public class LocationListen implements  LocationListener {

   private boolean isTracking;

 /* public LocationListen() {
  } */

  public void listenLocate() {

    	if (isTracking == false) {

    		isTracking = true;

    		try {

				Criteria cr = new Criteria();
				cr.setHorizontalAccuracy(500);

				LocationProvider lp = LocationProvider.getInstance(cr);
				lp.setLocationListener(this, -1, -1, -1);

			}
			catch (Exception e) {

			}
	    }
    }
  

  public void locationUpdated(LocationProvider provider, Location location){
  	LocationInfo locationInfo = new LocationInfo(location);
	Thread locationInfoThread = new Thread(locationInfo);
	locationInfoThread.start();
  }

  public void providerStateChanged(LocationProvider provider, int newState){}

  class LocationInfo implements Runnable {

  	Location location;
        String queryString;
        double lat;
        double lon;
   
  	LocationInfo(Location location) {

  		this.location = location;
  	}

  	public void run() {

  		try {

			Coordinates c = location.getQualifiedCoordinates();
			if (c != null) {
                            if (c != null) {
                     lat = c.getLatitude();
                     lon = c.getLongitude();
                     NetworkV6 s = new NetworkV6();
                     queryString = "/v3/locationUpdater.php?mobNumber=" + TaxiConsoleV6_beta.mobNumber+"&&lat=" +lat+"&&lng=" +lon+"";
                       s.sendHttpUrl3(queryString);

                  		}
                            
			}
			else {

				}

		}
		catch (Exception e) {

					}
  	}
  }

}

Open in new window

private void triggerLocationListener() {

}
LocationListen l = new LocationListen();
l.listenLocate();
}

Open in new window

Comment
Watch Question

>>l.listenLocate();

that should be inside a method!
you may want change like below

private void triggerLocationListener() {
  LocationListen l = new LocationListen();
  l.listenLocate();
}

Author

Commented:
Hi ksivananth....cant believe I did that!!!!!!!!
oh my god!!! think i should give up!!!!!!!

thanks for your quick response!!! hope nobody else saw it :-)