We help IT Professionals succeed at work.
Get Started

unable to call method from class in package

blossompark
blossompark asked
on
597 Views
Last Modified: 2013-12-14

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
Vice President
Commented:
This problem has been solved!
Unlock 2 Answers and 3 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE