我在我的应用程序中使用地图。我正在输入位置,地图打开。例如,我在那里找到了方向。地图计算到达输入点所需的时间。我可以以编程方式获得这段时间在我的应用程序中使用吗?
这是带有地图的代码片段。
Button destination_button = (Button) findViewById(R.id.button1);
destination_button.getBackground().setAlpha(64);
final EditText destination_tw = (EditText) findViewById(R.id.editText1);
destination_button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String string_for_entering_destination;
string_for_entering_destination = "q=" + destination_tw.getText().toString() + "&z=8";
// TODO Auto-generated method stub
// String geoUriString = "geo:0,10?z=2";
String geoUriString = "geo:0,0?" + string_for_entering_destination;
Uri geoUri = Uri.parse(geoUriString);
Intent mapIntent = new Intent(Intent.ACTION_VIEW, geoUri);
startActivity(mapIntent);
}
});