Comments (3)
Hi @mintheinwin ,
You are setting a single polyline. Could you try adding a polyline from A to B with a given color, and then another polyline from B to C with a different color?
from android-samples.
Hi @kikoso , Yes I had tried like that. I have solve my problem.
public ArrayList list = new ArrayList();
getPermissionAndLocationChange(list);
private void getPermissionAndLocationChange(final ArrayList<LatLng> tList) {
locationCallback = new LocationCallback() {
//This callback is where we get "streaming" location updates. We can check things like accuracy to determine whether
//this latest update should replace our previous estimate.
@Override
public void onLocationResult(LocationResult locationResult) {
if (locationResult == null) {
Log.d(TAG, "locationResult null");
return;
}
Log.d(TAG, "received " + locationResult.getLocations().size() + " locations");
for (Location loc : locationResult.getLocations()) {
tList.add(new LatLng(loc.getLatitude(), loc.getLongitude()));
//StampStyle stampStyle = TextureStyle.newBuilder(BitmapDescriptorFactory.fromResource(R.drawable.ic_arrow)).build();
if (colorStart == 0) {
styleSpanArrayList.add(new StyleSpan(StrokeStyle.colorBuilder(Color.GREEN).build()));
colorStart = 1;
} else if (colorStart == 1) {
styleSpanArrayList.add(new StyleSpan(StrokeStyle.colorBuilder(Color.YELLOW).build()));
colorStart = 2;
} else if (colorStart == 2) {
styleSpanArrayList.add(new StyleSpan(StrokeStyle.colorBuilder(Color.RED).build()));
colorStart = 0;
}
if (line!=null)line.remove();
line = map.addPolyline(new PolylineOptions().addAll(tList).width(30).addAllSpans(styleSpanArrayList));
/* tList.add(new LatLng(1.4384168567466844, 103.80680969583258));
styleSpanArrayList.add(new StyleSpan(StrokeStyle.colorBuilder(Color.GREEN).build()));
tList.add(new LatLng(1.4393477524038727, 103.80260854186459));
styleSpanArrayList.add(new StyleSpan(StrokeStyle.colorBuilder(Color.YELLOW).build()));
tList.add(new LatLng(1.4408750600926357, 103.80097019583253));
styleSpanArrayList.add(new StyleSpan(StrokeStyle.colorBuilder(Color.RED).build()));
Polyline line = map.addPolyline(new PolylineOptions().addAll(tList).width(30).addAllSpans(styleSpanArrayList));*/
}
}
@Override
public void onLocationAvailability(LocationAvailability locationAvailability) {
Log.d(TAG, "locationAvailability is " + locationAvailability.isLocationAvailable());
super.onLocationAvailability(locationAvailability);
}
};
}
from android-samples.
Great to know! Thanks for letting us know, @mintheinwin
from android-samples.
Related Issues (20)
- 3D mapping aided corrections HOT 1
- Only part of North and South Pole displayed based on zoom level HOT 2
- Google Maps For Android SDK could not display MapView on AAOS Emulator HOT 3
- How do you smooth MyLocation updates while receiving location requests through "setMyLocationEnabled" ? HOT 4
- Current Place Details on Map tutorial has outdated permissions handling HOT 1
- How to get requestLocationUpdates per second while device by walking? HOT 1
- snippet-bot full scan
- Marker's click event returns wrong marker. HOT 1
- Update targetSdk = compileSdk = 34 for Maps and Places HOT 1
- Remove renderer check from the app HOT 1
- Modernize our Android samples
- Adding a Styled Map sample for Kotlin HOT 1
- Provide example showcasing functionality of Advanced Markers HOT 1
- Move maps-rx snippets to app-rx snippets app
- Huge errors and warning in examples/java/BasicMap HOT 1
- Update dependencies so that tests pass HOT 1
- Memory leak in LiteListDemoActivity HOT 1
- Maps HOT 2
- A question for the Demo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-samples.