Android map popup on tap - android

I have followed twice this basic tutorial to create a map + an overlay with the AndroidMarker (when you tap him, a popup should appear)
And I still have the same problem, when I press the marker, the application crashed on the dialog.show().
Can you tell me how to debug such problem please ?
My sources can be found here (Link is dead. The requested topic does not exist.)
11-23 12:48:51.364: WARN/WindowManager(59): Attempted to add window with non-application token WindowToken{43f3eb70 token=null}. Aborting.
11-23 12:48:51.384: DEBUG/AndroidRuntime(307): Shutting down VM
11-23 12:48:51.384: WARN/dalvikvm(307): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): FATAL EXCEPTION: main
11-23 12:48:51.454: ERROR/AndroidRuntime(307): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.ViewRoot.setView(ViewRoot.java:509)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.app.Dialog.show(Dialog.java:241)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.markerTest.HelloItemizedOverlay.onTap(HelloItemizedOverlay.java:45)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.google.android.maps.ItemizedOverlay.onTap(ItemizedOverlay.java:453)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.google.android.maps.OverlayBundle.onTap(OverlayBundle.java:83)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.google.android.maps.MapView$1.onSingleTapUp(MapView.java:347)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.google.android.maps.GestureDetector.onTouchEvent(GestureDetector.java:533)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.google.android.maps.MapView.onTouchEvent(MapView.java:647)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.View.dispatchTouchEvent(View.java:3766)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1671)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.app.Activity.dispatchTouchEvent(Activity.java:2086)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1655)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.view.ViewRoot.handleMessage(ViewRoot.java:1785)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.os.Looper.loop(Looper.java:123)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at java.lang.reflect.Method.invoke(Method.java:521)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-23 12:48:51.454: ERROR/AndroidRuntime(307): at dalvik.system.NativeStart.main(Native Method)
11-23 12:48:51.534: WARN/ActivityManager(59): Force finishing activity com.markerTest/.markerTest
thx
Swan

I have found the solution here:
http://www.mailinglistarchive.com/html/android-beginners#googlegroups.com/2010-03/msg00219.html

Related

I can not execute my project in emulator

I am doing a simple project using google maps. My project is running fine in my mobile. But i can not run in emulator. When i try to execute the following error is showing..
11-23 12:50:44.187: E/AndroidRuntime(3128): FATAL EXCEPTION: main
11-23 12:50:44.187: E/AndroidRuntime(3128): Process: info.android.googlemapsv2, PID: 3128
11-23 12:50:44.187: E/AndroidRuntime(3128): java.lang.RuntimeException: Unable to resume activity {info.android.googlemapsv2/info.android.slidingmenu.SlideActivity}: java.lang.NullPointerException
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2788)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2817)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2250)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.ActivityThread.access$800(ActivityThread.java:135)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.os.Handler.dispatchMessage(Handler.java:102)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.os.Looper.loop(Looper.java:136)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.ActivityThread.main(ActivityThread.java:5017)
11-23 12:50:44.187: E/AndroidRuntime(3128): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:50:44.187: E/AndroidRuntime(3128): at java.lang.reflect.Method.invoke(Method.java:515)
11-23 12:50:44.187: E/AndroidRuntime(3128): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
11-23 12:50:44.187: E/AndroidRuntime(3128): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
11-23 12:50:44.187: E/AndroidRuntime(3128): at dalvik.system.NativeStart.main(Native Method)
11-23 12:50:44.187: E/AndroidRuntime(3128): Caused by: java.lang.NullPointerException
11-23 12:50:44.187: E/AndroidRuntime(3128): at com.tracker.newmaps.MainActivityNew.GetLocaion(MainActivityNew.java:210)
11-23 12:50:44.187: E/AndroidRuntime(3128): at com.tracker.newmaps.MainActivityNew.onResume(MainActivityNew.java:300)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.Fragment.performResume(Fragment.java:1743)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:924)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1044)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.FragmentManagerImpl.dispatchResume(FragmentManager.java:1863)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.Activity.performResume(Activity.java:5320)
11-23 12:50:44.187: E/AndroidRuntime(3128): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2778)
11-23 12:50:44.187: E/AndroidRuntime(3128): ... 12 more
I am using Google APIs x86(Google Inc.) Target api, and emulator also Google APIs x86(Google Inc.)
Please let me know how to run the project in my emulator.
Maybe in the emulator you don't have Google play services installed. This link could be helpful too.

Is Renderscript incompatible with NDK libraries in the same project?

I have a problem creating an Android app that makes use of both Renderscript and native code generated with NDK.
Substantially, I use NDK tools to generate a library called sprstr_native.so. I managed to call their C++ functions through Java code without problems. Then I needed some Renderscript functionalities (in particular, ScriptIntrinsicYuvToRGB) so I've added to my Eclipse project a reference to the relative support library, renderscript-v8.jar, and this line in the project properties file:
renderscript.support.mode=true
Now the problem: Android can't recognize my sprstr_native anymore and the app crashes when calling the code:
System.loadLibrary("sprstr_native");
This is the stack:
11-23 17:46:54.450: E/AndroidRuntime(3901): FATAL EXCEPTION: main
11-23 17:46:54.450: E/AndroidRuntime(3901): java.lang.ExceptionInInitializerError
11-23 17:46:54.450: E/AndroidRuntime(3901): at java.lang.Class.newInstanceImpl(Native Method)
11-23 17:46:54.450: E/AndroidRuntime(3901): at java.lang.Class.newInstance(Class.java:1409)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.os.Looper.loop(Looper.java:130)
11-23 17:46:54.450: E/AndroidRuntime(3901): at android.app.ActivityThread.main(ActivityThread.java:3683)
11-23 17:46:54.450: E/AndroidRuntime(3901): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 17:46:54.450: E/AndroidRuntime(3901): at java.lang.reflect.Method.invoke(Method.java:507)
11-23 17:46:54.450: E/AndroidRuntime(3901): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
11-23 17:46:54.450: E/AndroidRuntime(3901): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
11-23 17:46:54.450: E/AndroidRuntime(3901): at dalvik.system.NativeStart.main(Native Method)
11-23 17:46:54.450: E/AndroidRuntime(3901): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load sprstr_native: findLibrary returned null
11-23 17:46:54.450: E/AndroidRuntime(3901): at java.lang.Runtime.loadLibrary(Runtime.java:429)
11-23 17:46:54.450: E/AndroidRuntime(3901): at java.lang.System.loadLibrary(System.java:554)
11-23 17:46:54.450: E/AndroidRuntime(3901): at com.lag.proj.MainActivity.<clinit>(MainActivity.java:18)
11-23 17:46:54.450: E/AndroidRuntime(3901): ... 15 more
Curiously, if I delete all the references to Renderscript the native lib turns to work again!
Please don't tell me that there are incompatibilities between Renderscript and NDK code!
I've probably solved it, but not without other errors that came after (see Getting different errors for different platforms using Renderscript Support Library). By the way, the library loading phase should be solved by adding this line on the Application.mk file:
APP_ABI := all
That lets the NDK to compile the objs for all the supported architectures.

android:exception in map

I am implementing an app in which i have to use google map and code is as follows:
<com.google.android.maps.MapView
android:id="#+id/mapview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:apiKey="0ACHOtlugQlOpv7OWSc2GYfNmJfYY1ltGNlzgEQ"
android:clickable="true"
android:enabled="true" >
</com.google.android.maps.MapView>
and i got this exception:
11-23 12:50:52.796: I/System.out(24625): android.view.InflateException: Binary XML file line #68: Error inflating class com.google.android.maps.Mapview
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.os.Looper.loop(Looper.java:123)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.app.ActivityThread.main(ActivityThread.java:3687)
11-23 12:28:44.445: E/AndroidRuntime(24124): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:28:44.445: E/AndroidRuntime(24124): at java.lang.reflect.Method.invoke(Method.java:507)
11-23 12:28:44.445: E/AndroidRuntime(24124): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
11-23 12:28:44.445: E/AndroidRuntime(24124): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
11-23 12:28:44.445: E/AndroidRuntime(24124): at dalvik.system.NativeStart.main(Native Method)
11-23 12:28:44.445: E/AndroidRuntime(24124): Caused by: java.lang.NullPointerException
11-23 12:28:44.445: E/AndroidRuntime(24124): at com.trigma.mcs.Outsubmap.onCreate(Outsubmap.java:23)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-23 12:28:44.445: E/AndroidRuntime(24124): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
Did you specify the shared library in manifest file?
<uses-library android:name="com.google.android.maps" />
More info
This was due to mapActivity. Actully i forgot to extend mapactivity and by extending that my code worked.

android java.lang.VerifyError on startactivity in 1.6

I implement a project which contain a activity group mainActivity.
This main activity contains 3 other activity groups.
When I try to start myaccountactivity which is an activitygroup, it works for api more than 1.6 but if i tried to run it on 1.6 i get following wrror
11-23 12:22:15.005: ERROR/AndroidRuntime(412): java.lang.VerifyError: com.myproject.android.MyAccountActivity
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at java.lang.Class.newInstanceImpl(Native Method)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at java.lang.Class.newInstance(Class.java:1472)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityThread.startActivityNow(ActivityThread.java:2242)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at com.myproject.android.myproject.showMyAccountAtivity(myproject.java:396)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at com.myproject.android.myproject.onActivityResult(myproject.java:456)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.Activity.dispatchActivityResult(Activity.java:3625)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityGroup.dispatchActivityResult(ActivityGroup.java:123)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityThread.deliverResults(ActivityThread.java:3220)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3266)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityThread.access$2600(ActivityThread.java:116)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1823)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.os.Handler.dispatchMessage(Handler.java:99)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.os.Looper.loop(Looper.java:123)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at android.app.ActivityThread.main(ActivityThread.java:4203)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at java.lang.reflect.Method.invokeNative(Native Method)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at java.lang.reflect.Method.invoke(Method.java:521)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
11-23 12:22:15.005: ERROR/AndroidRuntime(412): at dalvik.system.NativeStart.main(Native Method)
I tried to fins out solution but no use. Please if anyody knows how to solve or knows reason why it is coming let me know..
Thanks
You're using functions from an SDK past 1.6, but you claim in your manifest that your app runs fine on 1.6. Set your build target to 1.6 to see which ones.

Is there anyone of troubleshooting or dealing with stack overflow errors when the trace shows nothing?

Got a trace like this:
java.lang.StackOverflowError
at android.widget.TextView.onMeasure(TextView.java:5160)
at android.view.View.measure(View.java:8172)
at android.widget.TableRow.getColumnsWidths(TableRow.java:308)
at android.widget.TableLayout.findLargestCells(TableLayout.java:497)
at android.widget.TableLayout.measureVertical(TableLayout.java:462)
at android.widget.TableLayout.onMeasure(TableLayout.java:428)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:696)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:306)
at android.view.View.measure(View.java:8172)
at android.widget.ListView.measureScrapChild(ListView.java:1135)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1200)
at android.widget.ListView.onMeasure(ListView.java:1109)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8172)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
at android.view.View.measure(View.java:8172)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
at android.view.View.measure(View.java:8172)
at android.view.ViewRoot.performTraversals(ViewRoot.java:805)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Is there anything that can be done here?
I'm getting reports of blank screens and force closes.
When stack traces don't help the best thing you can do is trace it.
Start to scatter log messages through strategic parts of your application, and once you find where it is set some breakpoints and step through.
Log.d("MyActivity", "MyClass.getView() — Initializing ");
Once you have your logs setup use LogCat

Categories

Resources