I want to calculate distance between two point by google map. i searched and i think that i use of Location object but when i write this:
import java.io.IOException;
import java.lang.Runnable;
import java.util.List;
import java.util.Locale;
import java.lang.Object;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.location.Address;
import android.location.Geocoder;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.view.View.OnKeyListener;
import android.view.KeyEvent;
import android.location.Location;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
Eclipse writes The android.location.Location; conflicts with a type defined in the same file. and when i create a location object Eclipse writes The constructor Location(string) is undefined.
Location location=new Location("");
What is the problem? What should i do? Cheers
The conflict may be caused because you may have defined your own Location class or are referring to another Location class defined by some other part of your project (maybe an external library).
Resolve these reference issues by using a fully qualified name. For example, if you have your own Location class then refer to it as com.mysampleapp.Location instead of just Location.
The constructor is not being recognized because it is referring to the other Location class in your project not the one provide by Google i.e. android.location.Location.
This will go away once you resolve the reference issue I just discussed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With