aviroez / osmbonuspack

Automatically exported from code.google.com/p/osmbonuspack
0 stars 0 forks source link

java.lang.NoSuchMethodError: org.osmdroid.bonuspack.overlays.ItemizedOverlayWithBubble.onDrawItem #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Compiling is now ok. 
2.Starting the run ... so transfer to my mobile ... then it crashes

What is the expected output? What do you see instead?
> A started App on my mobile. It dumps. 

What version of the product are you using?
> osmbonuspack jar v.1

Please provide any additional information below.
1. I had a simple working program with osmdroid
2. I added the following code ... see my attachment. This file is called from 
the Activity class. Nothing special there. 
3. I added the bonuspack_bubble.xml
4. Because no btn_moreinfo.png was there I created a simple PNG based on the 
arrow_moreinfo.png (or so) and the ic_menu. 

Background: I use a bridge from Mapsforge to Osmdroid. Works perfectly. 

Original issue reported on code.google.com by johan...@gmail.com on 13 Nov 2013 at 7:22

Attachments:

GoogleCodeExporter commented 9 years ago
1. osmbonuspack jar v.1? This is very very old... 

2. If you use bubbles, you MUST have in your project all resource files needed 
by bubbles, all of them with the exact naming needed. Please have a close look 
at the tutorials. 

3. If you still don't find the cause: look at the logcat. 

Original comment by mathieu....@gmail.com on 13 Nov 2013 at 9:42

GoogleCodeExporter commented 9 years ago
1. of course this should be osmbonuspack jar v 4.1. So very new ;-)

2. I was not intending to use bubbles (see my listing) but I got initially a 
crash/dump because the bonuspack_bubble.xml was missing. 

3. In the bonuspack_bubble.xml was referred to 
<Button android:id="@+id/bubble_moreinfo" 
android:background="@drawable/btn_moreinfo"

I wrongly added only a button to this name, yes, I see a btn_moreinfo.xml. 

My question: please have a quick look at my previously attached code. It is a 
short file.   ==> Can I omit the bubbles features? 

If I cannot omit, which files do I need? All res etc? 

Original comment by johan...@gmail.com on 14 Nov 2013 at 6:43

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I added the following files from the tutorial. 

    For a white bubble:
        drawable-mpi/bonuspack_bubble.9.png
        layout/bonuspack_bubble.xml 
    For a dark-grey bubble:
        drawable-mpi/bonuspack_bubble_black.9.png
        layout/bonuspack_bubble_black.xml 
    For the "more info" button:
        drawable/btn_moreinfo.xml
        drawable-mpi/moreinfo_arrow.png
        drawable-mpi/moreinfo_arrow_pressed.png 

The layout/bonuspack_bubble_black.xml and layout/bonuspack_bubble.xml. 
All other files (btm_moreifo.xml, *png) I added to the following folders: 

- drawable-hdpi
- drawable-ldpi
- drawable-mdpi
- drawable-xdpi
- drawable-xxdpi

There is no drawable folder in the Res folder. 

I did a refresh on the Res folder, so the ADT sees the files. 

The logcat dump reveals: 

11-14 20:11:01.900: E/AndroidRuntime(6086): FATAL EXCEPTION: main
11-14 20:11:01.900: E/AndroidRuntime(6086): java.lang.NoSuchMethodError: 
org.osmdroid.bonuspack.overlays.ItemizedOverlayWithBubble.onDrawItem
11-14 20:11:01.900: E/AndroidRuntime(6086):     at 
org.osmdroid.bonuspack.overlays.ItemizedOverlayWithBubble.drawSafe(ItemizedOverl
ayWithBubble.java:165)
11-14 20:11:01.900: E/AndroidRuntime(6086):     at 
org.osmdroid.views.overlay.SafeDrawOverlay.draw(SafeDrawOverlay.java:65)
11-14 20:11:01.900: E/AndroidRuntime(6086):     at 
org.osmdroid.views.overlay.OverlayManager.onDraw(OverlayManager.java:138)
Etc. 

Original comment by johan...@gmail.com on 14 Nov 2013 at 7:16

GoogleCodeExporter commented 9 years ago
If you don't need the bubble, you can use the osmdroid ItemizedIconOverlay. 
And if you use it, all resources you need are listed in Tutorial_1, chapter 3. 

Anyway - Logcat error is not related to bubble resources. 
NoSuchMethodError for ItemizedOverlayWithBubble.onDrawItem: this is really 
strange, as onDrawItem is a method of ItemizedOverlay. 

Which version of osmdroid are you using? 
Have you a modified version of osmdroid for your Mapsforge bridge? 

Original comment by mathieu....@gmail.com on 14 Nov 2013 at 9:38

GoogleCodeExporter commented 9 years ago
It works!
Thank you. 
I used osmdroid v3.10. After configuring osmdroid 4.0 it worked!

A Question: when I use the "marker_via.png" ... will the needle (or point) be 
exactly on the coördinate? For geocaching purposes this is important. 

I used in the code: nodeMarker.setMarkerHotspot( 
OverlayItem.HotspotPlace.CENTER);

Question 2: I have a second question. I would like to know how far the above 
coördinate is from the closest street. How can I calculate that? 

Original comment by johan...@gmail.com on 15 Nov 2013 at 7:08

GoogleCodeExporter commented 9 years ago
Question 1: for marker_via.png, you should set hotspot place to 
OverlayItem.HotspotPlace.BOTTOM_CENTER. Then, the bottom center of the marker 
will be exactly on the GeoPoint coordinates. 

Question 2: good question - maybe you can search in the local Mapsforge map to 
calculate that? 

And now, a request from my side: could you give us more details (and some 
hints?) about your Mapsforge bridge? This looks really interesting. You can 
create a separate issue for that. 

Original comment by mathieu....@gmail.com on 15 Nov 2013 at 9:28

GoogleCodeExporter commented 9 years ago
3. You can find it via 
http://www.salidasoftware.com/how-to-render-mapsforge-tiles-in-osmdroid. 

Can I ask you 1 more short question? To refresh the current coordinates / 
location, I see in the code that a pause() and resume() is (often) used. Is 
this really needed? Or is there a more simple way to have each 2 seconds allow 
for an update of the current coordinates?

After the answer, you/I could delete the last comments to keep the comments 
focussed on the issue. 

Original comment by johan...@gmail.com on 16 Nov 2013 at 9:26

GoogleCodeExporter commented 9 years ago
3. Thanks!

The method that set up the 2 secs update (activating the LocationListener 
feature) is startLocationUpdate. 
When the activity is not active, we don't want this 2 secs update to be done 
(for battery saving). So we stop it in onPause. And we activate it when the 
activity resumes: in onResume. 
You can look at 
http://developer.android.com/guide/topics/location/strategies.html for more 
info about location updates. 

Original comment by mathieu....@gmail.com on 16 Nov 2013 at 8:13