Note that there are some explanatory texts on larger screens.

plurals
  1. POdisplaying photo thumbnails on map
    primarykey
    data
    text
    <p>is there any good sample code on this? (displaying photo thumbnails on map)</p> <p>Below is the code that i've tried out by myself, but it just doesn't work: If the thumbnail path is found, set it as marker of the overlayitem, else use default Marker.</p> <p>The problem is that only items with defaultMarker are shown. And over 100+ photos, only 1 photo's thumbnail path is found, it seems that the way I retrieve thumbnail is somehow not correct.</p> <p>If you don't mind, it is quite verbose. Thanks!</p> <pre><code>Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker); PhotoOverlay itemizedoverlay = new PhotoOverlay(drawable, this); String selection = MediaStore.Images.ImageColumns.LATITUDE + " is not null"; Cursor c = this.managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, selection, null, null); while ( c.moveToNext()){ int longitude = (int) (c.getDouble(c.getColumnIndex(MediaStore.Images.ImageColumns.LONGITUDE)) * 1e6); int latitude = (int) ( c.getDouble(c.getColumnIndex(MediaStore.Images.ImageColumns.LATITUDE))* 1e6); String title = c.getString(c.getColumnIndex(MediaStore.Images.ImageColumns.TITLE)); String description = c.getString(c.getColumnIndex(MediaStore.Images.ImageColumns.DESCRIPTION)); long imgId = c.getLong(c.getColumnIndex(MediaStore.Images.ImageColumns._ID)); long thumbId = c.getLong(c.getColumnIndex(MediaStore.Images.ImageColumns.MINI_THUMB_MAGIC)); GeoPoint point = new GeoPoint(latitude, longitude); OverlayItem overlayitem = new OverlayItem(point, title, description); //Cursor ct = Thumbnails.queryMiniThumbnail(this.getContentResolver(), imgId, Thumbnails.MICRO_KIND, null); String[] args = new String[]{String.valueOf(thumbId)}; Cursor ct = managedQuery(Thumbnails.EXTERNAL_CONTENT_URI, null, Thumbnails._ID + "= ?", args, null); if( ct.moveToFirst() ){ String path = ct.getString(ct.getColumnIndex(Thumbnails.DATA)); BitmapDrawable d = new BitmapDrawable(this.getResources(), path); itemizedoverlay.addOverlay(overlayitem, d); } else { itemizedoverlay.addOverlay(overlayitem, null); } } c.close(); overlays.add(itemizedoverlay); </code></pre> <p>PhotoOverlay.addItem()</p> <pre><code>public void addOverlay(OverlayItem i, Drawable marker){ if( marker != null ){ i.setMarker(boundCenterBottom(marker)); } mOverlays.add(i); populate(); } </code></pre>
    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.
    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