Bug 19202 - Alert dialog causing GridView custom cell items click handler to be queued/delayed
Summary: Alert dialog causing GridView custom cell items click handler to be queued/de...
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.12.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-04-21 14:33 UTC by Jon Goldberger [MSFT]
Modified: 2014-06-27 14:00 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Test Project (21.97 KB, application/zip)
2014-04-21 14:33 UTC, Jon Goldberger [MSFT]

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Comment 1 Jon Goldberger [MSFT] 2014-04-21 14:34:56 UTC
From case:

I have a gridview that holds custom views. All was well until I tried to add an alert dialog to edit some of the fields in the custom view. If you edit some of the fields using the dialog, it will no longer handle click events until the gridview is scrolled (but they queued and handled when scrolled).

I created a project that duplicates the issue (attached). Here is how I can usually duplicate the problem:

1)Click the button that loads the gridview,
2)Click the top item group – it will load a dialog.
3)Type in some characters with the keyboard into the EditText.
4)Click Apply
5)Click next item in list (“blah1”) – if nothing happens, you have duplicated the bug.
6) If it brings up the dialog, repeat with other items until it stops responding to clicks

I am able to duplicate the issue on a LG G2 with Android 4.2.2, a dell venue 7 with Android 4.3, and a nexus 4 with Android 4.4.2

Hopefully it’s just something silly I am doing.
Comment 2 Chris Chelmecki 2014-04-21 17:19:22 UTC
Small update:

Jon had a concern that it was somehow related to the view recycling in getview.  The sample project I sent only has a single item in the gridview, so it should get the same item every time, but I added the standard convertview null check and just returned convertview in case it was doing something strange.  Same results.
Comment 3 Ram Chandra 2014-04-24 13:34:19 UTC
I have checked this issue and with the help of "Comment 1" I am able to reproduce this issue.

I have observed that when I am running the attached sample on emulator ( API 16) I am not getting this issue at all. I am able to click on all the items and it is working perfectly fine but when I deploy attached sample on device , I am able to replicate this issue.

I have also checked that I am getting this issue only when I enter some text on text box and click on either "Apply" or "Cancel" button.This issue doesn't occurs if I do not enter anything on text box  and click on "Apply" and "cancel" button.

I am also getting different out logs for different devices.

Application output logs(HTC  One) : https://gist.github.com/saurabh360/8ae29a0c67c5200f7bee
Application output logs (Samsung S4): https://gist.github.com/saurabh360/5fd8a3ca2162818d8e83

Device logs (HTC one V): https://gist.github.com/saurabh360/607a361f52a5518ebf57
Device logs (Samsung S4):  https://gist.github.com/saurabh360/a540f8b8c70b2fb59185

Environment Info:

Xamarin Studio
Version 4.2.3 (build 60)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
	Mono 3.2.6 ((no/9b58377)
	GTK+ 2.24.23 theme: Raleigh
	GTK# (
	Package version: 302060000

Apple Developer Tools
Xcode 5.1 (5084)
Build 5B130a

Version: (Trial Edition)
Hash: 58c3efa
Build date: 2014-10-03 18:02:26-0400

Version: 4.12.1 (Starter Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Xamarin.Mac: 1.6.27

Build Information
Release ID: 402030060
Git revision: 30c4afc300c2a39ec5300851357ce02e49dd217e
Build date: 2014-03-05 22:09:33+0000
Xamarin addins: f8a9589b57c2bfab2ccd73c880e7ad81e3ecf044

Operating System
Mac OS X 10.9.2
Comment 4 Evan Harris 2014-06-27 05:04:01 UTC
I believe I've been able to reproduce this in another scenario on the emulator. 

1. Create a non parented dialog (launched in its own window) over the top of a grid view with an attached ItemClick event handler. 

2. Set the dialog to not be cancelled on touch outside and not be cancellable. Set the NotTouchModel flag on the dialog's window.

3. Launch the dialog. At this point the gridview will respond to scroll events but will not fire the itemclick event when its internal controls are selected. Other controls will receive touch events but items in the grid view will not be selectable.

4. When the dialog has been dismissed (by calling its Cancel method) the gridview will fire the selected event for items in the view once again.

I've reproduced this on Android API 16, 17 and 18. On API 19 (4.4.2) the selected event is fired and doesn't appear to be affected.
Comment 5 Jonathan Pryor 2014-06-27 14:00:52 UTC
This appears to be an Android-ism (i.e. "not my problem ;-)"):


A workaround is to specify ActivityAttribute.WindowSoftInputMode:

    [Activity(Label = "BugDuplication", MainLauncher = true,
    public partial class MainActivity : Activity {