This causes a crash because you cannot call methods on a nonexistent object.
I assume you are talking about android.location.Location?
This is usually returned by various Android positioning services. What do you want to do with this?
Do you want to change the geocode? How to find the address for this geo-coordinate?
Or do you want to use it as a "fake" position and submit it to other applications?
There are two BTW constructors. One takes the name of the positioning service, and the other takes the copy constructor and takes the existing location.
So you can create a location like this:
Location l = new Location("network");
But I do not think that this will lead to something that you want to have.
Here is the link to the documentation:
https://developer.android.com/reference/android/location/Location.html#Location%28java.lang.String%29
Dirk jΓ€ckel
source share