How To Draw Polyline Along With Multi Marker In Google Map From Mysql
I already build an app using google maps V2 and put ii markers on the map. Start marker is to get user current location, and the second mark is user destination location. And then I add decodePoly method to describe line between those markers. I also add method to requite user information near durations,start address and destination address using alert dialog.
So, when I click the second marker, i want to animate that marker to "motion" to kickoff marker. Merely my problem is, the second mark is not moving on the polyline path. y'all can see at image below:
This is MapActivity.coffee:
@Override public boolean onMarkerClick(Marker arg0) { // if user click the get-go marking if(this.lokasi_asli.equals(arg0)){ AlertDialog.Builder alert = new AlertDialog.Architect(MapActivity.this); alert.setTitle("Starting time Position") .setIcon(R.drawable.ic_launcher) .setCancelable(true) .setMessage("Beginning Position : " + " " + loc_a) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); alert.show(); } else if (this.lokasi_tujuan.equals(arg0)) { //if user click second mark final boolean hideMarker = false; final Handler handler = new Handler(); last long start = SystemClock.uptimeMillis(); Projection proj = gmap.getProjection(); Indicate startPoint = proj.toScreenLocation(lokasi_tujuan.getPosition()); final LatLng startLatLng = proj.fromScreenLocation(startPoint); concluding long duration = 5000; final Interpolator interpolator = new LinearInterpolator(); handler.mail service(new Runnable() { @Override public void run() { long elapsed = SystemClock.uptimeMillis() - start; float t = interpolator.getInterpolation((float) elapsed / elapsing); double longid = t * lokasi_asli.getPosition().longitude + (one-t) * startLatLng.longitude; double latid = t * lokasi_asli.getPosition().breadth + (1-t) * startLatLng.latitude; lokasi_tujuan.setPosition(new LatLng(latid, longid)); if(t < 1.0){ // handler.postDelayed(this, xvi); } else { if(hideMarker){ lokasi_tujuan.setVisible(imitation); } else { lokasi_tujuan.setVisible(true); } } } }); fetch data from google map:
@Override protected void onPostExecute(Void effect){ super.onPostExecute(event); if(physician != zero){ NodeList _nodelist = medico.getElementsByTagName("condition"); Node node1 = _nodelist.particular(0); String _status1 = node1.getChildNodes().item(0).getNodeValue(); if(_status1.equalsIgnoreCase("OK")) { NodeList _nodelist_path = medico.getElementsByTagName("overview_polyline"); Node node_path = _nodelist_path.particular(0); Element _status_path = (Element)node_path; NodeList _nodelist_destination_path = _status_path.getElementsByTagName("points"); Node _nodelist_dest = _nodelist_destination_path.detail(0); Cord _path = _nodelist_dest.getChildNodes().item(0).getNodeValue(); List<LatLng> directionPoint = decodePoly(_path); PolylineOptions rectLine = new PolylineOptions().width(10).color(Color.Ruddy).geodesic(truthful); for (int i = 0; i < directionPoint.size(); i++) { rectLine.add(directionPoint.become(i)); } gmap.addPolyline(rectLine); mark_opt.position(new LatLng(dest_lat, dest_long)); mark_opt.draggable(true); mark_opt.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)); lokasi_tujuan = gmap.addMarker(mark_opt); } else { Toast.makeText(MapActivity.this, "Maaf, Tidak dapat menemukan rute tujuan Coba pilih rute lain yang mendekati", Toast.LENGTH_LONG).show(); } progres_dlg.dismiss(); } } } How tin can i make the second mark move on the polyline path?? Whatever ideas or help would exist profoundly appreciated. Environment : Windows 7, Eclipse, Genymotion.
Run across Question&Answers more detail:os
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Source: https://jike.in/?qa=1055510/android-how-to-animate-google-map-v2-marker-on-the-polyline-path
Posted by: parkblegame94.blogspot.com

0 Response to "How To Draw Polyline Along With Multi Marker In Google Map From Mysql"
Post a Comment