Advertisement
Meskiusa

Untitled

Mar 26th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. private void markerUpdate() {
  2. Handler mainHandler = new Handler(Looper.getMainLooper());
  3.  
  4. MapsActivity.this.runOnUiThread(() -> {
  5. TimerTask timerTask = new TimerTask() {
  6. @RequiresApi(api = Build.VERSION_CODES.O)
  7. @Override
  8. public void run() {
  9. Runnable myRunnable = () -> {
  10. try {
  11. GetUrlContentTask.cleanMap();
  12. }catch (NullPointerException e){
  13. e.printStackTrace();
  14. }};
  15. mainHandler.post(myRunnable);
  16.  
  17. new GetUrlContentTask().execute("https://www.stops.lt/klaipeda/gps.txt?1548774463");
  18. // new GetUrlContentTask().execute("https://www.stops.lt/klaipeda/gps.txt?"+ String.valueOf(Instant.now().getEpochSecond()));
  19. }
  20. };
  21. new Timer().schedule(timerTask,50,10000);
  22.  
  23. });
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement