mono/MonoGame — pull request #606 by Aranda (2012-07-21 14:08:02+00:00)
Title: Develop3d - Fix crash when calling Guide.BeginShowKeyboardInput on Galaxy S devices

This exception may happen on lots of other devices too, but it does not happen on my Novo Tornado tablet. The exception "Java.Lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()" was thrown when "new EditText(Game.Activity)" was called.

I fixed it by wrapping the whole AlertDialog creation in the Activity.RunOnUiThread invoker. I think it's probably better that it blocks the UI thread sooner rather than later anyway. Creating the AlertDialog can take a while on slower devices (> 1 sec), so blocking the UI thread may avoid users tapping stuff whilst the AlertDialog is being created. In the future we should consider whether the text entry AlertDialog should be pre-created and cached, or possibly just cached after the first creation.

Note that the changes appear more radical than they are due to some white space cleanup.