14
मैं एक एंड्रॉइड एप्लिकेशन विकसित कर रहा हूं और GoogleMaps API v2 का उपयोग कर रहा हूं। यह आवेदन अब तक काम करता है लेकिन मैं एक पथ के साथ नक्शा खोज करना चाहते हैं:Google मानचित्र एपीआई वी 2 एंड्रॉइड में कैसे खोजें?
स्क्रीनशॉट:
मेरी कोड:
Position_mark = new LatLng(35.7008, 51.437);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(Position_mark, 15));
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
map.setOnMapClickListener(this);
map.setOnMapLongClickListener(this);
map.setOnMarkerDragListener(this);
...
@Override
public boolean onCreateOptionsMenu(Menu menu) {
//Used to put dark icons on light action bar
mGoItem = menu.add(0, Delete_ITEM_ID, 0, null);
mGoItem.setIcon(R.drawable.ic_launcher)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
SearchView searchView =
new SearchView(getSupportActionBar().getThemedContext());
searchView.setQueryHint("Search for Places…");
searchView.setIconified(false);
menu.add("Search")
.setIcon(R.drawable.abs__ic_search)
.setActionView(searchView)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String newText) {
return true;
}
/**
* Called when the query text is changed by the user.
* @param newText the new content of the query text field.
* @return false if the SearchView should perform the
* default action of showing any suggestions if available,
* true if the action was handled by the listener.
*/
@Override
public boolean onQueryTextChange(String newText) {
Toast.makeText(getApplicationContext(), newText, 1).show();
return true;
}
});
return true;
}
@Override
public void onMapClick(LatLng point) {
// TODO Auto-generated method stub
// tvLocInfo.setText(point.toString());
map.animateCamera(CameraUpdateFactory.newLatLng(point));
map.clear();
Marker Kiel = map.addMarker(new MarkerOptions()
.position(point)
.title("Kiel")
.snippet("Kiel is cool").draggable(true)
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.ic_launcher)));
}
मैं ActionBarSherlock
औरका उपयोग करता हूं खोज के लिए। पथ के साथ GoogleMaps API में खोज कैसे करें अक्षांश या देशांतर?
इस उदाहरण me..thanks के लिए http://wptrafficanalyzer.in/blog/android-searchview-widget-with-google-places-api-using-actionbarsherlock- बहुत अच्छा है पुस्तकालय –
यह उदाहरण काम नहीं करता ..... –
@Kavyan Google मानचित्र में स्थान खोजने के लिए geocoding का उपयोग करना अच्छा नहीं है। क्योंकि यह सभी उपकरणों में काम नहीं कर रहा है .. – Riser