Clicking links in custom listview - android

I'm attempting to put together a library for Twitter feeds and I've got most of it working, but I'm running into an issue where links in my text are crashing when clicked, and I wanted to see if anyone could point me in the right direction for fixing this.
The main text field of my tweet is defined in XML as this:
<TextView
android:textColor="#android:color/black"
android:id="#+id/TweetUITweetTextTextView"
android:padding="#dimen/tweetTextPadding"
android:layout_toRightOf="#+id/TweetUIUserProfileImageView"
android:layout_below="#+id/TweetUIUsernameTextView"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:linksClickable="true"
android:autoLink="web"
android:text="#null" />
And this is located inside of a relative layout that I expand into a custom "TweetView" class.
The TweetView takes a Tweet Object that is basically a set of strings that contain the information parsed from a JSON query and sets those strings (In this case, the main text from the Tweet with anchor tags and whatnot from the URL metadata in the Twitter JSON feed) to the textview with this:
if( tweet.tweetText != null && tweet.tweetText != "" )
tweetTextTextView.setText( Html.fromHtml( tweet.tweetTextWithLinks ) );
else
tweetTextTextView.setText( "" );
As for my error stack on crash, I have this:
05-30 14:42:22.206: E/InputEventReceiver(22150): Exception dispatching input event.
05-30 14:42:22.206: E/MessageQueue-JNI(22150): Exception in MessageQueue callback: handleReceiveCallback
05-30 14:42:22.216: E/MessageQueue-JNI(22150): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.app.ContextImpl.startActivity(ContextImpl.java:944)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.app.ContextImpl.startActivity(ContextImpl.java:931)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.content.ContextWrapper.startActivity(ContextWrapper.java:284)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.text.style.URLSpan.onClick(URLSpan.java:62)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.text.method.LinkMovementMethod.onTouchEvent(LinkMovementMethod.java:212)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.widget.TextView.onTouchEvent(TextView.java:7536)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.View.dispatchTouchEvent(View.java:7246)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2174)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1917)
05-30 14:42:22.216: E/MessageQueue-JNI(22150): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1953)
.....
Thank you!

Probably you pass "wrong" context in your adapter. E.g. application context instead of activity context.

Related

Parcelable encountered IOException writing serializable object: java.io.NotSerializableException: org.json.JSONArray

I got this error logout sometimes, I know this logcat means my ABCModel is not serializable but it is. All the model instances which are used inside ABCModel are all serialized,
Here is the complete Logcat:
05-30 11:38:49.249: E/AndroidRuntime(4305): FATAL EXCEPTION: main
05-30 11:38:49.249: E/AndroidRuntime(4305): java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name =
com.kxs.project.model.ABCModel)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeSerializable(Parcel.java:1181)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeValue(Parcel.java:1135)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeMapInternal(Parcel.java:493)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Bundle.writeToParcel(Bundle.java:1612)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeBundle(Parcel.java:507)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.support.v4.app.FragmentState.writeToParcel(Fragment.java:132)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeTypedArray(Parcel.java:1004)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.support.v4.app.FragmentManagerState.writeToParcel(FragmentManager.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeParcelable(Parcel.java:1156)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeValue(Parcel.java:1075)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeMapInternal(Parcel.java:493)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Bundle.writeToParcel(Bundle.java:1612)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeBundle(Parcel.java:507)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:1919)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.handleStopActivity(ActivityThread.java:2869)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.access$900(ActivityThread.java:124)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1165)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Looper.loop(Looper.java:137)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.app.ActivityThread.main(ActivityThread.java:4436)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 11:38:49.249: E/AndroidRuntime(4305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 11:38:49.249: E/AndroidRuntime(4305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 11:38:49.249: E/AndroidRuntime(4305): at dalvik.system.NativeStart.main(Native Method)
05-30 11:38:49.249: E/AndroidRuntime(4305): Caused by: java.io.NotSerializableException: org.json.JSONArray
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1364)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeFieldValues(ObjectOutputStream.java:979)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:368)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeHierarchy(ObjectOutputStream.java:1074)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeNewObject(ObjectOutputStream.java:1404)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObjectInternal(ObjectOutputStream.java:1671)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1517)
05-30 11:38:49.249: E/AndroidRuntime(4305): at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:1481)
05-30 11:38:49.249: E/AndroidRuntime(4305): at android.os.Parcel.writeSerializable(Parcel.java:1176)
05-30 11:38:49.249: E/AndroidRuntime(4305): ... 24 more
05-30 11:38:49.249: E/AndroidRuntime(4305): Caused by: java.io.NotSerializableException: org.json.JSONArray
Probably somewhere in your model contains the JSONArray object. It is not serializable: JSONArray source code

I can't install apk from eclipse

I've installed eclipse in a new computer with windows 8, I've copy the workspace from my old PC and now I can open the projects and work with them normally, but when I try to install the apk in a device or in the emulator, appears an error in the console:
Installation failed due to invalid APK file!
Please check logcat output for more details.
Launch canceled!
This is the logcat:
> 05-30 13:11:54.054: W/PackageParser(3644): Unable to read AndroidManifest.xml of /data/local/tmp/J i A.apk
05-30 13:11:54.054: W/PackageParser(3644): java.io.FileNotFoundException: AndroidManifest.xml
05-30 13:11:54.054: W/PackageParser(3644): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
05-30 13:11:54.054: W/PackageParser(3644): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
05-30 13:11:54.054: W/PackageParser(3644): at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:455)
05-30 13:11:54.054: W/PackageParser(3644): at android.content.pm.PackageParser.parsePackageLite(PackageParser.java:649)
05-30 13:11:54.054: W/PackageParser(3644): at com.android.defcontainer.DefaultContainerService$1.getMinimalPackageInfo(DefaultContainerService.java:144)
05-30 13:11:54.054: W/PackageParser(3644): at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:102)
05-30 13:11:54.054: W/PackageParser(3644): at android.os.Binder.execTransact(Binder.java:338)
05-30 13:11:54.054: W/PackageParser(3644): at dalvik.system.NativeStart.run(Native Method)
05-30 13:11:54.054: W/DefContainer(3644): Failed to parse package
05-30 13:11:54.062: I/ApplicationPolicy(187): isApplicationInstallationEnabled
05-30 13:11:54.062: W/PackageManager(187): verifying app can be installed or not
05-30 13:11:54.062: W/PackageParser(3644): Unable to read AndroidManifest.xml of /data/local/tmp/J i A.apk
05-30 13:11:54.062: W/PackageParser(3644): java.io.FileNotFoundException: AndroidManifest.xml
05-30 13:11:54.062: W/PackageParser(3644): at android.content.res.AssetManager.openXmlAssetNative(Native Method)
05-30 13:11:54.062: W/PackageParser(3644): at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
05-30 13:11:54.062: W/PackageParser(3644): at android.content.res.AssetManager.openXmlResourceParser(AssetManager.java:455)
05-30 13:11:54.062: W/PackageParser(3644): at android.content.pm.PackageParser.parsePackageLite(PackageParser.java:649)
05-30 13:11:54.062: W/PackageParser(3644): at com.android.defcontainer.DefaultContainerService$1.getMinimalPackageInfo(DefaultContainerService.java:144)
05-30 13:11:54.062: W/PackageParser(3644): at com.android.internal.app.IMediaContainerService$Stub.onTransact(IMediaContainerService.java:102)
05-30 13:11:54.062: W/PackageParser(3644): at android.os.Binder.execTransact(Binder.java:338)
05-30 13:11:54.062: W/PackageParser(3644): at dalvik.system.NativeStart.run(Native Method)
05-30 13:11:54.062: W/DefContainer(3644): Failed to parse package
05-30 13:11:54.062: W/ActivityManager(187): No content provider found for permission revoke: file:///data/local/tmp/J i A.apk
If I try to export the application to generate the apk file, appears a dialog that says "Failed to export application".
Any idea to solve this? I can't test my app or generate the apk in anyway.
Check the target SDK for the android app and make sure you have that SDK version installed. You can change it in project properties.

java.lang.RuntimeException : Could not open input channel pair

I'm testing my application with three phones (running andorid version : 4.1.2 - 4.0.4 - 2.3.6). They exchange data via Bluetooth without problems until this error appears in the logcat and the phone shutdowns completely and restarts. Before this error appears everything works perfectly.
Here is the logcat output on the phone that crashes (the one running version 4.1.2):
05-29 12:11:36.887: E/InputTransport(2947): channel '418655a8 Toast' ~ Could not create socket pair. errno=24
05-29 12:11:36.897: E/JavaBinder(2947): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
05-29 12:11:36.897: E/JavaBinder(2947): java.lang.RuntimeException: Could not open input channel pair. status=-24
05-29 12:11:36.897: E/JavaBinder(2947): at android.view.InputChannel.nativeOpenInputChannelPair(Native Method)
05-29 12:11:36.897: E/JavaBinder(2947): at android.view.InputChannel.openInputChannelPair(InputChannel.java:91)
05-29 12:11:36.897: E/JavaBinder(2947): at com.android.server.wm.WindowManagerService.addWindow(WindowManagerService.java:2295)
05-29 12:11:36.897: E/JavaBinder(2947): at com.android.server.wm.Session.add(Session.java:139)
05-29 12:11:36.897: E/JavaBinder(2947): at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:70)
05-29 12:11:36.897: E/JavaBinder(2947): at com.android.server.wm.Session.onTransact(Session.java:111)
05-29 12:11:36.897: E/JavaBinder(2947): at android.os.Binder.execTransact(Binder.java:367)
05-29 12:11:36.897: E/JavaBinder(2947): at dalvik.system.NativeStart.run(Native Method)
05-29 12:11:36.897: E/WindowManager(2947): Window Session Crash
05-29 12:11:36.897: E/WindowManager(2947): java.lang.RuntimeException: Could not open input channel pair. status=-24
05-29 12:11:36.897: E/WindowManager(2947): at android.view.InputChannel.nativeOpenInputChannelPair(Native Method)
05-29 12:11:36.897: E/WindowManager(2947): at android.view.InputChannel.openInputChannelPair(InputChannel.java:91)
05-29 12:11:36.897: E/WindowManager(2947): at com.android.server.wm.WindowManagerService.addWindow(WindowManagerService.java:2295)
05-29 12:11:36.897: E/WindowManager(2947): at com.android.server.wm.Session.add(Session.java:139)
05-29 12:11:36.897: E/WindowManager(2947): at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:70)
05-29 12:11:36.897: E/WindowManager(2947): at com.android.server.wm.Session.onTransact(Session.java:111)
05-29 12:11:36.897: E/WindowManager(2947): at android.os.Binder.execTransact(Binder.java:367)
05-29 12:11:36.897: E/WindowManager(2947): at dalvik.system.NativeStart.run(Native Method)
05-29 12:11:36.907: D/AndroidRuntime(8234): Shutting down VM
05-29 12:11:36.907: W/dalvikvm(8234): threadid=1: thread exiting with uncaught exception (group=0x40abc300)
05-29 12:11:36.927: E/AndroidRuntime(8234): FATAL EXCEPTION: main
05-29 12:11:36.927: E/AndroidRuntime(8234): java.lang.RuntimeException: InputChannel is not initialized.
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.view.InputEventReceiver.nativeInit(Native Method)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.view.InputEventReceiver.<init>(InputEventReceiver.java:68)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.view.ViewRootImpl$WindowInputEventReceiver.<init>(ViewRootImpl.java:4221)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.view.ViewRootImpl.setView(ViewRootImpl.java:626)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:326)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:220)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.widget.Toast$TN.handleShow(Toast.java:391)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.widget.Toast$TN$1.run(Toast.java:309)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.os.Handler.handleCallback(Handler.java:615)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.os.Handler.dispatchMessage(Handler.java:92)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.os.Looper.loop(Looper.java:137)
05-29 12:11:36.927: E/AndroidRuntime(8234): at android.app.ActivityThread.main(ActivityThread.java:4931)
05-29 12:11:36.927: E/AndroidRuntime(8234): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 12:11:36.927: E/AndroidRuntime(8234): at java.lang.reflect.Method.invoke(Method.java:511)
05-29 12:11:36.927: E/AndroidRuntime(8234): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
05-29 12:11:36.927: E/AndroidRuntime(8234): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
05-29 12:11:36.927: E/AndroidRuntime(8234): at dalvik.system.NativeStart.main(Native Method)
05-29 12:11:36.947: W/ActivityManager(2947): Force finishing activity com.vittorio/.tabContainer.FloatyTab
05-29 12:11:36.967: E/IMemory(2947): binder=0x23b2708 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error: 2147483646)
05-29 12:11:36.967: E/IMemory(2947): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
05-29 12:11:36.967: E/IMemory(2947): cannot map BpMemoryHeap (binder=0x23b2708), size=0, fd=-1 (Bad file number)
I don't know how this could be triggered by my application, there is not even one line inside this error output that points to one of my classes.
Also on my S3 with android v4.1.1 I got this error and the phone rebooted after 80 min of normal activity:
05-29 16:13:47.455: E/InputChannel-JNI(7490): Error 9 dup channel fd -2147483647.
05-29 16:13:47.455: D/AndroidRuntime(7490): Shutting down VM
05-29 16:13:47.455: W/dalvikvm(7490): threadid=1: thread exiting with uncaught exception (group=0x4101a2a0)
05-29 16:13:47.465: E/AndroidRuntime(7490): FATAL EXCEPTION: main
05-29 16:13:47.465: E/AndroidRuntime(7490): java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.view.InputChannel.nativeReadFromParcel(Native Method)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.view.InputChannel.readFromParcel(InputChannel.java:135)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.view.IWindowSession$Stub$Proxy.add(IWindowSession.java:523)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.view.ViewRootImpl.setView(ViewRootImpl.java:663)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:345)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:220)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.widget.Toast$TN.handleShow(Toast.java:431)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.widget.Toast$TN$1.run(Toast.java:348)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.os.Handler.handleCallback(Handler.java:615)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.os.Handler.dispatchMessage(Handler.java:92)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.os.Looper.loop(Looper.java:137)
05-29 16:13:47.465: E/AndroidRuntime(7490): at android.app.ActivityThread.main(ActivityThread.java:4898)
05-29 16:13:47.465: E/AndroidRuntime(7490): at java.lang.reflect.Method.invokeNative(Native Method)
05-29 16:13:47.465: E/AndroidRuntime(7490): at java.lang.reflect.Method.invoke(Method.java:511)
05-29 16:13:47.465: E/AndroidRuntime(7490): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
05-29 16:13:47.465: E/AndroidRuntime(7490): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
05-29 16:13:47.465: E/AndroidRuntime(7490): at dalvik.system.NativeStart.main(Native Method)
And again my S3 resetted with the same error of my Samsung S plus (v 4.1.2) after correctly working for 3 hours, here is the log:
05-30 14:11:59.455: E/InputTransport(2262): channel '422b4910 Toast' ~ Could not create socket pair. errno=24
05-30 14:11:59.465: E/JavaBinder(2262): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
05-30 14:11:59.465: E/JavaBinder(2262): java.lang.RuntimeException: Could not open input channel pair. status=-24
05-30 14:11:59.465: E/JavaBinder(2262): at android.view.InputChannel.nativeOpenInputChannelPair(Native Method)
05-30 14:11:59.465: E/JavaBinder(2262): at android.view.InputChannel.openInputChannelPair(InputChannel.java:91)
05-30 14:11:59.465: E/JavaBinder(2262): at com.android.server.wm.WindowManagerService.addWindow(WindowManagerService.java:2931)
05-30 14:11:59.465: E/JavaBinder(2262): at com.android.server.wm.Session.add(Session.java:139)
05-30 14:11:59.465: E/JavaBinder(2262): at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:70)
05-30 14:11:59.465: E/JavaBinder(2262): at com.android.server.wm.Session.onTransact(Session.java:111)
05-30 14:11:59.465: E/JavaBinder(2262): at android.os.Binder.execTransact(Binder.java:367)
05-30 14:11:59.465: E/JavaBinder(2262): at dalvik.system.NativeStart.run(Native Method)
05-30 14:11:59.465: E/WindowManager(2262): Window Session Crash
05-30 14:11:59.465: E/WindowManager(2262): java.lang.RuntimeException: Could not open input channel pair. status=-24
05-30 14:11:59.465: E/WindowManager(2262): at android.view.InputChannel.nativeOpenInputChannelPair(Native Method)
05-30 14:11:59.465: E/WindowManager(2262): at android.view.InputChannel.openInputChannelPair(InputChannel.java:91)
05-30 14:11:59.465: E/WindowManager(2262): at com.android.server.wm.WindowManagerService.addWindow(WindowManagerService.java:2931)
05-30 14:11:59.465: E/WindowManager(2262): at com.android.server.wm.Session.add(Session.java:139)
05-30 14:11:59.465: E/WindowManager(2262): at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:70)
05-30 14:11:59.465: E/WindowManager(2262): at com.android.server.wm.Session.onTransact(Session.java:111)
05-30 14:11:59.465: E/WindowManager(2262): at android.os.Binder.execTransact(Binder.java:367)
05-30 14:11:59.465: E/WindowManager(2262): at dalvik.system.NativeStart.run(Native Method)
05-30 14:11:59.470: D/AndroidRuntime(13879): Shutting down VM
05-30 14:11:59.470: W/dalvikvm(13879): threadid=1: thread exiting with uncaught exception (group=0x410c92a0)
05-30 14:11:59.475: E/AndroidRuntime(13879): FATAL EXCEPTION: main
05-30 14:11:59.475: E/AndroidRuntime(13879): java.lang.RuntimeException: InputChannel is not initialized.
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.view.InputEventReceiver.nativeInit(Native Method)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.view.InputEventReceiver.<init>(InputEventReceiver.java:68)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.view.ViewRootImpl$WindowInputEventReceiver.<init>(ViewRootImpl.java:4477)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.view.ViewRootImpl.setView(ViewRootImpl.java:738)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:345)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:220)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.widget.Toast$TN.handleShow(Toast.java:431)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.widget.Toast$TN$1.run(Toast.java:348)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.os.Handler.handleCallback(Handler.java:615)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.os.Handler.dispatchMessage(Handler.java:92)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.os.Looper.loop(Looper.java:137)
05-30 14:11:59.475: E/AndroidRuntime(13879): at android.app.ActivityThread.main(ActivityThread.java:4898)
05-30 14:11:59.475: E/AndroidRuntime(13879): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 14:11:59.475: E/AndroidRuntime(13879): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 14:11:59.475: E/AndroidRuntime(13879): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
05-30 14:11:59.475: E/AndroidRuntime(13879): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
05-30 14:11:59.475: E/AndroidRuntime(13879): at dalvik.system.NativeStart.main(Native Method)
05-30 14:11:59.515: E/IMemory(2262): cannot dup fd=1023, size=765952, err=0 (Too many open files)
05-30 14:11:59.515: E/IMemory(2262): cannot map BpMemoryHeap (binder=0x5efc9c38), size=765952, fd=-1 (Bad file number)
05-30 14:11:59.515: A/libc(2262): Fatal signal 11 (SIGSEGV) at 0x000075df (code=1), thread 4933 (Binder_9)
05-30 14:11:59.515: A/libc(2262): Unable to open connection to debuggerd: Too many open files
05-30 14:11:59.685: W/Sensors(24753): sensorservice died [0x40d75010]
this is a bug.
maybe you can check https://code.google.com/p/android/issues/detail?id=32470 for some updates..

How to display an image in an image button with shared preferences?

In one of my activities you can click on an image button and a dialog opens up to ask you to open up the Gallery. Once opened up you can click on one of those images in your gallery.
What I want that the clicked image is set as the image of the image button. This image should stay there even when the user kills the app (when he opens up the app again the chosen image should still be there).
I chose to do all this work with the shared preferences but can't get it working. I get an error when I click on an image in the gallery. Any suggestions??
UPDATE: The error I receive is:
Unfortunately, the process com.myname.android has stopped
Here is my code, beginning with the onActivityResult:
private String selectedImagePath;
private String mFileName;
#Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
if (requestCode == PICK_FROM_FILE) {
Uri selectedImageUri = data.getData();
selectedImagePath = getPath(selectedImageUri);
Log.v("IMAGE PATH====>>>> ",selectedImagePath);
}
storePath();
retrievePath();
convertPathToImage();
}
}
private void storePath() {
final SharedPreferences sPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
final Editor spEditor = sPreference.edit();
spEditor.putString("img_path", mFileName);
spEditor.commit();
}
private void retrievePath() {
final SharedPreferences sharedPreference = getSharedPreferences(
"pref_key", MODE_PRIVATE);
if (sharedPreference.contains("img_path")) {
mFileName = sharedPreference.getString("img_path",
null);
}
}
private void convertPathToImage() {
File imgFile = new File(mFileName);
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageButton myImage = (ImageButton) findViewById(R.id.image);
myImage.setImageBitmap(myBitmap);
}
}
And here is the LogCat:
05-30 15:27:14.567: D/dalvikvm(634): GC_CONCURRENT freed 1K, 3% free 11478K/11783K, paused 5ms+4ms
05-30 15:27:14.597: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:14.617: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:14.926: D/gralloc_goldfish(634): Emulator without GPU emulation detected.
05-30 15:27:26.767: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:26.877: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:30.616: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:30.626: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:32.086: W/IInputConnectionWrapper(634): showStatusIcon on inactive InputConnection
05-30 15:27:33.366: E/ActivityThread(634): Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): android.app.IntentReceiverLeaked: Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:763)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:567)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1043)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1030)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ContextImpl.registerReceiver(ContextImpl.java:1024)
05-30 15:27:33.366: E/ActivityThread(634): at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:341)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.content.PackageMonitor.register(PackageMonitor.java:65)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ResolverActivity.onCreate(ResolverActivity.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.app.ChooserActivity.onCreate(ChooserActivity.java:53)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Activity.performCreate(Activity.java:4465)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:33.366: E/ActivityThread(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:33.366: E/ActivityThread(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:33.366: E/ActivityThread(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:33.366: E/ActivityThread(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:33.366: E/ActivityThread(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:35.987: V/IMAGE PATH====>>>>(634): /mnt/sdcard/Mercedes_SLS_AMG.jpg
05-30 15:27:36.176: D/AndroidRuntime(634): Shutting down VM
05-30 15:27:36.176: W/dalvikvm(634): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
05-30 15:27:36.206: E/AndroidRuntime(634): FATAL EXCEPTION: main
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.xyz.android.taskreminder/com.xyz.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2980)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3023)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.access$1100(ActivityThread.java:123)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1177)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.os.Looper.loop(Looper.java:137)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.lang.reflect.Method.invoke(Method.java:511)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-30 15:27:36.206: E/AndroidRuntime(634): at dalvik.system.NativeStart.main(Native Method)
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.fixSlashes(File.java:185)
05-30 15:27:36.206: E/AndroidRuntime(634): at java.io.File.<init>(File.java:134)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.convertPathToImage(ReminderEditActivity.java:249)
05-30 15:27:36.206: E/AndroidRuntime(634): at com.xyz.android.taskreminder.ReminderEditActivity.onActivityResult(ReminderEditActivity.java:227)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.Activity.dispatchActivityResult(Activity.java:4649)
05-30 15:27:36.206: E/AndroidRuntime(634): at android.app.ActivityThread.deliverResults(ActivityThread.java:2976)
05-30 15:27:36.206: E/AndroidRuntime(634): ... 11 more
05-30 15:27:36.376: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.396: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:36.787: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:36.847: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.386: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.406: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:37.887: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:37.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.396: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.416: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:38.897: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:38.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.406: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.426: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:39.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:39.927: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.446: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:40.917: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:40.947: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.426: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.447: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:41.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:41.977: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:42.937: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:42.956: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.446: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.467: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:43.947: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:43.976: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.456: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.477: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:44.966: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:44.986: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
05-30 15:27:45.466: I/dalvikvm(634): threadid=3: reacting to signal 3
05-30 15:27:45.487: I/dalvikvm(634): Wrote stack traces to '/data/anr/traces.txt'
Activity com.android.internal.app.ChooserActivity has leaked IntentReceiver com.android.internal.app.ResolverActivity$1#4155da80 that was originally registered here. Are you missing a call to unregisterReceiver()?
This is probably a bug in Android. See http://code.google.com/p/android/issues/detail?id=29399. It shouldn't effect the app though which should still be able to get a result back from the gallery.
05-30 15:27:36.206: E/AndroidRuntime(634): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/20 }} to activity {com.ndroidstudios.android.taskreminder/com.ndroidstudios.android.taskreminder.ReminderEditActivity}: java.lang.NullPointerException
...
05-30 15:27:36.206: E/AndroidRuntime(634): Caused by: java.lang.NullPointerException
This is the problem. mFileName is null when you try to use it to create a new File. In retrievePath, when you try to pull "img_path" out of your preferences the default value is null, so I'm guessing it's getting set to null there. Check in the debugger to make sure mFileName is getting set to a valid String from your preferences.

Google API MapView OutOfMemory after setting the MapView to specific width and height

i searched for this Problem, and i found some stackoverflow Questions about the same but without any idea how to resolve the problem.
I created an activity and i want to add a really small mapview (like 140w X 70h). It is only to show a small preview of where the place is. When you click this little mapview you get a new inflate to a new activity with the hole map.
MapView:
<com.google.android.maps.MapView android:id="#+id/mapview"
android:layout_width="140dip"
android:layout_height="80dip"
android:layout_below="#id/attributes"
android:layout_alignParentRight="true"
android:apiKey="****"
android:paddingBottom="60dp"/>
LogCat:
05-30 14:34:53.758: ERROR/dalvikvm(1608): Out of memory: Heap Size=4039KB, Allocated=2768KB, Bitmap Size=625KB
05-30 14:34:53.758: DEBUG/AndroidRuntime(1608): Shutting down VM
05-30 14:34:53.758: WARN/dalvikvm(1608): threadid=1: thread exiting with uncaught exception (group=0x400259f8)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): FATAL EXCEPTION: main
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): java.lang.OutOfMemoryError
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.google.googlenav.map.Map.resize(Unknown Source)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.google.android.maps.MapView.onMeasure(MapView.java:554)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:989)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.ScrollView.onMeasure(ScrollView.java:286)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:578)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:362)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3140)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.View.measure(View.java:8172)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.performTraversals(ViewRoot.java:805)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.os.Handler.dispatchMessage(Handler.java:99)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.os.Looper.loop(Looper.java:144)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at android.app.ActivityThread.main(ActivityThread.java:4937)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at java.lang.reflect.Method.invokeNative(Native Method)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at java.lang.reflect.Method.invoke(Method.java:521)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-30 14:34:53.768: ERROR/AndroidRuntime(1608): at dalvik.system.NativeStart.main(Native Method)
this is the error. When i use fill_parent it works, but i dont want a mapview with fill_parent.
Maybe you guys know another way to get a preview small image of the current (or given) position on the map as image.
Isn't it possible to show a small mapview ?
thanks
If you just want to show a static map without interaction I recommend the static map api from google. You can define markers, the center, the size and some labels and it returns a generated image that can be easily shown inside a ImageView. The benefit of this: You don't have to invoke a complete MapView for just a small map image. No overhead of memory or user interaction. Perfect for the scenario you have.

Categories

Resources