Note that there are some explanatory texts on larger screens.

plurals
  1. POSearching location in android map via edittext
    primarykey
    data
    text
    <p>I am on the way of developing a map service in android and I want to search a particular place like 'Berlin' in my map. For that I placed an EDITTEXT in my map and whenever I am entering the name I want to get that place in my map pointed with the marker. </p> <p>This is my HelloItemizedOverlay class:</p> <pre><code> public class HelloItemizedOverlay extends ItemizedOverlay&lt;OverlayItem&gt; { private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;(); private Context mContext; public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); mContext = context; } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } @Override public int size() { return mOverlays.size(); } @Override protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(item.getTitle()); dialog.setMessage(item.getSnippet()); dialog.show(); return true; } } </code></pre> <p>This is my main class:</p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mapView = (MapView) findViewById(R.id.mapView); mapSearchBox = (EditText)findViewById(R.id.search); mapSearchBox.setOnTouchListener(new View.OnTouchListener(){ public boolean onTouch(View view, MotionEvent motionEvent) { List&lt;Address&gt; addresses = geocoder.getFromLocationName(mapSearchBox.getText().toString(),5); if(addresses.size() &gt; 0) { GeoPoint p = new GeoPoint( (int) (addresses.get(0).getLatitude() * 1E6), (int) (addresses.get(0).getLongitude() * 1E6)); controller.animateTo(p); controller.setZoom(12); List&lt;Overlay&gt; mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().getDrawable(R.drawable.icon); HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable,this); OverlayItem overlayitem = new OverlayItem(p,"",""); itemizedoverlay.addOverlay(overlayitem); mapOverlays.add(itemizedoverlay); mapView.invalidate(); mapSearchBox.setText(""); } else { AlertDialog.Builder adb = new AlertDialog.Builder(GoogleMapActivity.this); adb.setTitle("Google Map"); adb.setMessage("Please Provide the Proper Place"); adb.setPositiveButton("Close",null); adb.show(); } return false; }}); LocationManager locationManager = (LocationManager) getSystemService(this.LOCATION_SERVICE); LocationListener listener = new MylocationListener(); locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,0,listener); } </code></pre> <p>Here I am getting an error message in the line : </p> <pre><code> Drawable drawable = this.getResources().getDrawable(R.drawable.icon); </code></pre> <p>saying getresource method is undefined for new View. OnTouchListener; also an another error is showing in the very next line :</p> <pre><code> HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable,this); </code></pre> <p>The constructor HelloItemizedOverlay is undefined.</p> <p>Does anybody know a suggestion?? If so, please do this favour. Thanks in advance!!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload