如何在路线google maps v2 android上绘制交互式Polyline
我有以下代码为我绘制折线并且工作正常,但问题是它没有绘制交互式折线,绘制的线条缺少一些像素!
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONObject;
public class testRoute extends FragmentActivity implements OnClickListener {
private GoogleMap myMap;
Polyline line;
Context context;
// Static LatLng
LatLng startLatLng = new LatLng(30.707104, 76.690749);
LatLng endLatLng = new LatLng(30.721419, 76.730017);
public void onCreate(Bundle bd) {
super.onCreate(bd);
setContentView(R.layout.passanger_home_call);
context = testRoute.this;
// Temp GetTrails Button
Button btntemp = (Button) findViewById(R.id.btn_pass_home_call_temp);
btntemp.setOnClickListener(this);
// GoogleMap myMap
myMap = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map_pass_home_call)).getMap();
myMap.setMyLocationEnabled(true);
myMap.moveCamera(CameraUpdateFactory.newLatLng(startLatLng));
myMap.animateCamera(CameraUpdateFactory.zoomTo(12));
// Now auto clicking the button
btntemp.performClick();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_pass_home_call_temp:
String urlTopass = makeURL(startLatLng.latitude,
startLatLng.longitude, endLatLng.latitude,
endLatLng.longitude);
new connectAsyncTask(urlTopass).execute();
break;
default:
break;
}
}
代码正常工作和绘制路线从一个地方到另一个地方, 但没有绘制交互式路线
扬帆大鱼
相关分类