Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Thread restartLocation = new Thread(new Runnable() {
- @Override
- public void run() {
- while (true) {
- try {
- Thread mThis = Thread.currentThread();
- while(restartLocation == mThis) {
- for(int i = 0; i < 10; i++) {
- Log.d("Delay", i+" seconds");
- Thread.sleep(1000);
- }
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- map.setMyLocationEnabled(true);
- }
- });
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- });
- //When the map is drag stop it update with the users location
- //If the user drags the map to look around they dont want it moving back
- mf.setOnDragListener(new TouchableWrapper.OnDragListener() {
- @Override
- public void onDrag(MotionEvent motionEvent) {
- map.setMyLocationEnabled(false);
- Log.d("Map", "Stopped location and remove drag listener");
- if (motionEvent.getActionMasked() == MotionEvent.ACTION_UP) {
- //Stop restartLocation if it's running
- restartLocation.start();
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement