fletc900 (2) [Avatar] Offline
#1
Greetings,

I was looking at your Chapter 15 example for drag and drop and found an unexpected behaviour that leads to freezing issues after you do about 20-30 drag and drop operations.

Looking at the debug output on logcat, I get the error posted in the end of my message. To see this freeze issue on your Chapter 15 drag and drop example, just comment out:

bmps[1], bmps[2], bmps[3], bmps[4] such that your array has only one element (i.e., bmps[0]).

Then compile, and start dragging the ImageView between your (bottomRight,bottomLeft,etc.) views...shouldn't take more than 30 drag and drop operations to freeze. Any idea what is causing this?


08-28 00:17:50.810: ERROR/WindowManager(144): Unregister of nonexistent drag input channel
08-28 00:18:39.700: ERROR/View(8836): Unable to initiate drag
08-28 00:18:39.700: ERROR/View(8836): java.lang.IllegalArgumentException
08-28 00:18:39.700: ERROR/View(8836): at android.view.Surface.lockCanvasNative(Native Method)
08-28 00:18:39.700: ERROR/View(8836): at android.view.Surface.lockCanvas(Surface.java:350)
08-28 00:18:39.700: ERROR/View(8836): at android.view.View.startDrag(View.java:11467)
08-28 00:18:39.700: ERROR/View(8836): at org.flexware.dnd.DndActivity$ImgAdapter$1.onLongClick(DndActivity.java:89)
08-28 00:18:39.700: ERROR/View(8836): at android.view.View.performLongClick(View.java:312smilie
08-28 00:18:39.700: ERROR/View(8836): at android.view.View$CheckForLongPress.run(View.java:11910)
08-28 00:18:39.700: ERROR/View(8836): at android.os.Handler.handleCallback(Handler.java:587)
08-28 00:18:39.700: ERROR/View(8836): at android.os.Handler.dispatchMessage(Handler.java:92)
08-28 00:18:39.700: ERROR/View(8836): at android.os.Looper.loop(Looper.java:132)
08-28 00:18:39.700: ERROR/View(8836): at android.app.ActivityThread.main(ActivityThread.java:4123)
08-28 00:18:39.700: ERROR/View(8836): at java.lang.reflect.Method.invokeNative(Native Method)
08-28 00:18:39.700: ERROR/View(8836): at java.lang.reflect.Method.invoke(Method.java:491)
08-28 00:18:39.700: ERROR/View(8836): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-28 00:18:39.700: ERROR/View(8836): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-28 00:18:39.700: ERROR/View(8836): at dalvik.system.NativeStart.main(Native Method)
08-28 00:18:44.710: ERROR/WindowManager(144): Unregister of nonexistent drag input channel

I get the same behavior if I replace your StackView with another view (such as a TextView).

Is this an Android bug? Or a coding one? Or is it just me?


Thanks,
BF
fletc900 (2) [Avatar] Offline
#2
Re: Drag and drop example - Chapter 15 - Unexpected behaviour
Hi there. Me again. Just say that I get the same exact error by using the original code as that is posted on google code (http://code.google.com/p/android-in-practice/source/browse/#svn%2Ftrunk%2Fch15%2FDragAndDrop); there is no need to comment out the 4 last elements in the array. Just compile and use the long press to move the StackViews between the containers. While you do that, keep an eye on the LogCat output; within 30 drag and drop operations, the code will fail (giving the same error output as previously described) and the drag and drop listener will cease to respond. I've verified that this fails on both the Motorola Xoom and also when using the emulator.

This is a pity since the Drag and Drop was deemed as one of the most exciting additions to the Honeycomb platform (paraphrasing one of the authors http://fupeg.blogspot.com/2011/03/honeycomb-drag-and-drop-basics.html).


Regards.
BF