location

get current Location in Android

Deadly 提交于 2019-12-12 03:09:38
问题 I tried to get the current location in Android. At least, I took this example from this post. How do I get the current GPS location programmatically in Android? While this post is five years old, commonsware told me to ask a new question. Here is my code Snippet. @Override public void onCreate(Bundle arg0) { super.onCreate(arg0); Log.i(TAG, "onCreate"); setHasOptionsMenu(true); mActivity = (CustomerTabs) this.getActivity(); mActivity.getActionBar().hide(); if (checkGooglePlayServicesAvailable

NMEA message to Android Location

倾然丶 夕夏残阳落幕 提交于 2019-12-12 02:41:21
问题 I am working with an external GPS, since they are far more accurate. I already have the bluetooth connection worked out, but now I'm stuck in a flood of NMEA formatted messages. It seems like, since you can get NMEA out of the built in GPS stack, that there must be a way to get a Location given a NMEA message. How do I go about converting my NMEA messages into useful Location objects? 回答1: NMEA is quite easy to parse. There are various types of sentences for different things. For location

googleapis geocode APPROXIMATE and wrong location

↘锁芯ラ 提交于 2019-12-12 02:29:48
问题 The following request results in wrong (approx.) coordinates (about 600 meters from correct location): http://maps.googleapis.com/maps/api/geocode/json?address=Garbatyplatz+2+13187+Berlin&sensor=true => "lat" : 52.57206610, "lng" : 13.41266040 www.google.com/maps/preview#!q=52.57206610%2C+13.41266040 But if you look for the address directly in google maps, it is correct: https://www.google.de/maps/preview#!q=Garbatyplatz+2+13187+Berlin Anybody an idea why the result is approx. and so much off

Tab Page Header Location

大兔子大兔子 提交于 2019-12-12 02:27:00
问题 I have a Tab Control in my Form and what I want to achieve is a simple way to get the exact location the Tab Page Header. I've searched around, but I haven't found anything. Any ideas? 回答1: This will make the Tab control blink a little but it will return a list of bounding Rectangles for the pages' headers.. SortedDictionary<int, Rectangle> GetTabBounds(TabControl tab) { SortedDictionary<int, Rectangle> bounds = new SortedDictionary<int, Rectangle>(); TabDrawMode tdm = tab.DrawMode;

Android AsyncTask & LocationListener

我只是一个虾纸丫 提交于 2019-12-12 02:26:52
问题 I created a class GPSController . The onReceive is called every Minute. I want to get the current GPS Data with the GPSListener in my AsyncTask . But the onLocationChanged Method is never called. :-/ Here is my Class: public class GPSController extends SensorTimeController { // The minimum distance to change Updates in meters private static final long MIN_DISTANCE_CHANGE_FOR_UPDATES = 0; // The minimum time between updates in milliseconds private static final long MIN_TIME_BW_UPDATES = 2;

Get Latitude and Longitude from Time Zone in Java

≡放荡痞女 提交于 2019-12-12 02:24:55
问题 I'm trying to write a world clock app that returns the sunrise and sunset information for a given time zone. The thinking is that the user will either specify the GMT offset or give the time zone explicitly. Then the application will look up the latitude and longitude using the java.util.TimeZone found (or possibly given the GMT offset). I realize the time zones are usually not a very accurate way to get geolocation information since they are mostly based on political borders, but it seems

LatLng and distance between returning incorrect values on newer phones

佐手、 提交于 2019-12-12 02:06:42
问题 My app works great on my old HTC One M7 in terms of calculating distance. However, on my wife's HTC One M8 and on my new Sony Xperia Z3, the distance it calculates is off. It's telling me that I've gone further than I really have. I've noticed this more when I'm hiking or running. If I'm skiing, it seems to be more accurate. I'm guessing that speed has something to do with it (if I'm going faster, the calculations are more accurate). I'm calling a method to update my total distance on every

How to set the standard Iconified location for a JInternalFrame?

守給你的承諾、 提交于 2019-12-12 02:05:11
问题 I've got a class extending JDesktopPane in which I have a JInternalFrame, which I can Iconify, I really like this, but when I iconify it, it goes to the left, bottom side of my screen. I'd like to change this to the right, top side of the screen. Does anyone have any suggestions on how to set that location? 回答1: You're using the DefaultDesktopManager to manage your JDesktopPane . The DefaultDesktopManager class implements the DesktopManager interface. Looking at the source code for

Android HandlerThread stops working when device unplugged from USB cable

百般思念 提交于 2019-12-12 02:04:16
问题 My application includes a Service that spawns a HandlerThread that periodically requests a location update from the LocationManager. Each time I receive a location updated I disable location updates, and send a delayed message to the Hander that will start updates again in the future: public class VMLocator extends HandlerThread implements LocationListener { ... private final class VMHandler extends Handler { public VMHandler(Looper looper) { super(looper); } @Override public void

How do you retrieve the “Place” field of a Facebook Graph Post object?

浪尽此生 提交于 2019-12-12 01:59:17
问题 I am trying to retrieve the "Place" field of a Facebook Graph Post object from a Facebook friend. After obtaining an access token with the friends_status and read_stream permissions, I request from the Graph API like so: http://graph.facebook.com/[user_id]_[post_id] What is returned are some of the fields described in the Graph API docs for Post: { "id": "1164358582_2458311174854", "from": { "name": "Joe Blo", "id": "1164358582" }, "message": "Is pretty bummed today", "actions": [ { "name":