Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - ItemizedOverlay Adding Items and onTap Issue

ItemizedOverlay Adding Items and onTap Issue

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

ItemizedOverlay Adding Items and onTap Issue

Postby aspekt9 » Fri Feb 05, 2010 5:35 am

When I add a new item to my ItemizedOverlay the onTap display I have set appears X times, where X is equal to the number of items that I added. So for example, if I add one item and tap it, it the onTap method gets called once, and in the LogCat I get:

Code: Select all
02-04 23:28:56.188: INFO/NotificationService(52): enqueueToast pkg=android.mapit callback=android.app.ITransientNotification$Stub$Proxy@4394c100 duration=0


If I add a second item and click ANY of the other items, the onTap method gets called twice and I get the following in LogCat:

Code: Select all
02-04 23:29:29.408: INFO/NotificationService(52): enqueueToast pkg=android.mapit callback=android.app.ITransientNotification$Stub$Proxy@438b4048 duration=0
02-04 23:29:29.418: INFO/NotificationService(52): enqueueToast pkg=android.mapit callback=android.app.ITransientNotification$Stub$Proxy@43950d20 duration=0


If I add a third item and click ANY of the other items, the onTap method gets called three times and I get the following in LogCat:


Code: Select all
02-04 23:30:32.007: INFO/NotificationService(52): enqueueToast pkg=android.mapit callback=android.app.ITransientNotification$Stub$Proxy@4394fcf8 duration=0
02-04 23:30:32.017: INFO/NotificationService(52): enqueueToast pkg=android.mapit callback=android.app.ITransientNotification$Stub$Proxy@43950408 duration=0
02-04 23:30:32.028: INFO/NotificationService(52): enqueueToast pkg=android.mapit callback=android.app.ITransientNotification$Stub$Proxy@438babe0 duration=0



Any idea why this would occur? I'm running into issues with it affecting other things like removal of items.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class POIItemizedOverlay extends ItemizedOverlay {
  2.  
  3.  
  4.  
  5.         SparseArray<OverlayItem> mOverlays = new SparseArray<OverlayItem>();
  6.  
  7.         int key = 0;
  8.  
  9.         Context mContext;
  10.  
  11.         Projection proj;
  12.  
  13.         List<Overlay> mapOverlays;
  14.  
  15.     OverlayItem overlayItem;
  16.  
  17.     MapView view;
  18.  
  19.     boolean remove;
  20.  
  21.     public POIDatabase db;
  22.  
  23.     boolean done;
  24.  
  25.    
  26.  
  27.         public POIItemizedOverlay(Context context, Drawable defaultMarker, MapView mapView) {
  28.  
  29.                 super(boundCenterBottom(defaultMarker));
  30.  
  31.                 mContext = context;
  32.  
  33.                 proj = mapView.getProjection();
  34.  
  35.                 view = mapView;
  36.  
  37.         mapOverlays = mapView.getOverlays();
  38.  
  39.         db = new POIDatabase(mContext);
  40.  
  41.         }
  42.  
  43.        
  44.  
  45.         public void populatePOIs() {
  46.  
  47.                 db.open();
  48.  
  49.                 Cursor c = db.getAllGeoPoints();
  50.  
  51.                 clearAll();
  52.  
  53.                 if (c.moveToFirst()) {
  54.  
  55.                         do {
  56.  
  57.                                 GeoPoint d = new GeoPoint(Integer.parseInt(c.getString(2)), Integer.parseInt(c.getString(1)));
  58.  
  59.                                 overlayItem = new OverlayItem(d, c.getString(3), c.getString(4));
  60.  
  61.                                 this.addOverlay(overlayItem, (Integer.parseInt(c.getString(0))-1));
  62.  
  63.                                 mapOverlays.add(this);
  64.  
  65.                         } while (c.moveToNext());
  66.  
  67.                         done = true;
  68.  
  69.                 }
  70.  
  71.                 setLastFocusedIndex(-1);
  72.  
  73.                 db.close();
  74.  
  75.         }
  76.  
  77.        
  78.  
  79.         public void addLocation(GeoPoint p, String title, String desc) {
  80.  
  81.                 db.open();
  82.  
  83.                 if (done == true) {
  84.  
  85.                         Cursor c = db.getAllGeoPoints();
  86.  
  87.                         c.moveToLast();
  88.  
  89.                         key = Integer.parseInt(c.getString(0));
  90.  
  91.                 } else {
  92.  
  93.                         key = 0;
  94.  
  95.                         done = true;
  96.  
  97.                 }
  98.  
  99.                 db.insertGeoPoint(p.getLongitudeE6(), p.getLatitudeE6(), title, desc, 1, 1);
  100.  
  101.                 OverlayItem overlayItem = new OverlayItem(p, title, desc);
  102.  
  103.                 this.addOverlay(overlayItem, key);
  104.  
  105.                 mapOverlays.add(this);
  106.  
  107.                 db.close();
  108.  
  109.         }
  110.  
  111.        
  112.  
  113.         public void remove() {
  114.  
  115.                 this.remove = true;
  116.  
  117.         }
  118.  
  119.        
  120.  
  121.         public void addOverlay(OverlayItem overlay, int key) {
  122.  
  123.                 Log.w("DONE", String.valueOf(done));
  124.  
  125.                 mOverlays.put(key, overlay);
  126.  
  127.                 populate();
  128.  
  129.                 view.invalidate();
  130.  
  131.         }
  132.  
  133.  
  134.  
  135.         public void removeOverlay(int pIndex) {
  136.  
  137.                 //db.open();
  138.  
  139.                 //db.deleteGeoPoint(mOverlays.get(pIndex).getPoint().getLongitudeE6());
  140.  
  141.                 //db.close();
  142.  
  143.                 //mOverlays.delete(pIndex);
  144.  
  145.                 System.out.println(pIndex);
  146.  
  147.                 mOverlays.delete(pIndex);
  148.  
  149.                 setLastFocusedIndex(-1);
  150.  
  151.                 //view.invalidate();
  152.  
  153.         }
  154.  
  155.        
  156.  
  157.         public void clearAll() {
  158.  
  159.                 db.open();
  160.  
  161.                 db.deleteAllGeoPoints();
  162.  
  163.                 db.close();
  164.  
  165.                 mOverlays.clear();
  166.  
  167.                 view.invalidate();
  168.  
  169.         }
  170.  
  171.         @Override
  172.  
  173.         public boolean onTap(int pIndex) {
  174.  
  175.                 if (this.remove == true) {
  176.  
  177.                         removeOverlay(pIndex);
  178.  
  179.                         Log.w("PINDEX", String.valueOf(pIndex));
  180.  
  181.                         this.remove = false;
  182.  
  183.                         Toast.makeText(mContext, "POI Removed", Toast.LENGTH_SHORT).show();
  184.  
  185.                 } else {
  186.  
  187.                         Toast.makeText(mContext, mOverlays.get(pIndex).getSnippet(), Toast.LENGTH_SHORT).show();
  188.  
  189.                 }
  190.  
  191.                 return false;
  192.  
  193.         }
  194.  
  195.        
  196.  
  197.         @Override
  198.  
  199.         protected OverlayItem createItem(int i) {
  200.  
  201.           return mOverlays.get(i);
  202.  
  203.         }
  204.  
  205.  
  206.  
  207.         @Override
  208.  
  209.         public int size() {
  210.  
  211.                 // TODO Auto-generated method stub
  212.  
  213.                 return mOverlays.size();
  214.  
  215.         }
  216.  
  217. }
Parsed in 0.014 seconds, using GeSHi 1.0.8.4
aspekt9
Junior Developer
Junior Developer
 
Posts: 12
Joined: Tue Feb 24, 2009 5:13 am

Top

boolean to return from onTap()

Postby EsterYtterbrink » Tue Apr 13, 2010 11:54 am

Hi, have you tried to return true from your onTap() ?

http://code.google.com/intl/sv-SE/andro ... index.html

To return false indicates that you want the event that generated it to pass to other overlays.

best regards Ester Ytterbrink
EsterYtterbrink
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Apr 13, 2010 11:49 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 1 guest