0

i want to use countdown timer inside infowindow ,the value of timer is changing in Background but the textview is not updating.the textview is setting only when i click the marker .plz tell a possible solution or someother idea

mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
                                        @Override
                                        public View getInfoWindow(final Marker marker) {
                                            myMarker = mMarkersHashMap.get(marker);
                                            runOnUiThread(new Runnable() {
                                                @Override
                                                public void run() {
                                                    timer1 = new CountDownTimer(Long.parseLong(myMarker.getTime()), 1000) {
                                                        @Override
                                                        public void onTick(long millisUntilFinished) {

                                                            String hms = String.format("%02d:%02d",
                                                                    TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished),
                                                                    TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished) -
                                                                            TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished)));
                                                            Log.d("fsdf", hms);
                                                            infoTitle.setText(hms);

                                                            String check=infoTitle.getText().toString();
                                                            if(!check.equals(null)) {
                                                                Log.d("check 1", hms);
                                                                if (!check.equals(hms)) {
                                                                    Log.d("check 2", hms);
                                                                    infoTitle.setText(hms);
                                                                    marker.showInfoWindow();

                                                                }
                                                            }

                                                        }

                                                        @Override
                                                        public void onFinish() {
                                                            infoTitle.setText("00");
                                                        }

                                                    }.start();
                                                }
                                            });


                                            infoButtonListener.setMarker(marker);

                                            mapWrapperLayout.setMarkerWithInfoWindow(marker, infoWindow);
                                            return infoWindow;
                                        }

                                        @Override
                                        public View getInfoContents(Marker marker) {


                                            return null;
                                        }
                                    });

`

nigin
  • 3
  • 1
  • The timer is working when is use it on some other place ,but it is not working inside the marker infowindow – nigin Aug 16 '16 at 08:15

1 Answers1

0

What you are trying to achieve is not possible.The info-window contents is rendered and presentment as an image on the maps.

You can't update view's...

If You try this it may work... Google Maps Android API v2 - Interactive InfoWindow (like in original android google maps)

Community
  • 1
  • 1
deepak p
  • 76
  • 2