{"action":"created","issue":{"url":"https://api.github.com/repos/xamarin/urho/issues/341","repository_url":"https://api.github.com/repos/xamarin/urho","labels_url":"https://api.github.com/repos/xamarin/urho/issues/341/labels{/name}","comments_url":"https://api.github.com/repos/xamarin/urho/issues/341/comments","events_url":"https://api.github.com/repos/xamarin/urho/issues/341/events","html_url":"https://github.com/xamarin/urho/issues/341","id":339940921,"node_id":"MDU6SXNzdWUzMzk5NDA5MjE=","number":341,"title":"LineEdit on Android crashes on second open","user":{"login":"woychukb","id":41079088,"node_id":"MDQ6VXNlcjQxMDc5MDg4","avatar_url":"https://avatars1.githubusercontent.com/u/41079088?v=4","gravatar_id":"","url":"https://api.github.com/users/woychukb","html_url":"https://github.com/woychukb","followers_url":"https://api.github.com/users/woychukb/followers","following_url":"https://api.github.com/users/woychukb/following{/other_user}","gists_url":"https://api.github.com/users/woychukb/gists{/gist_id}","starred_url":"https://api.github.com/users/woychukb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/woychukb/subscriptions","organizations_url":"https://api.github.com/users/woychukb/orgs","repos_url":"https://api.github.com/users/woychukb/repos","events_url":"https://api.github.com/users/woychukb/events{/privacy}","received_events_url":"https://api.github.com/users/woychukb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-10T17:37:00Z","updated_at":"2018-11-10T14:10:16Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I've got a Urhosharp.Forms project that I'm trying to test on Android (both physical and emulator) and I'm getting exceptions on the second time the LineEdit control is selected.\r\n\r\nSteps to reproduce:\r\nStart app (on emulator or physical device)\r\nTouch LineEdit control\r\nTouch anywhere else on screen\r\nTouch LineEdit control again (or a different LineEdit control)\r\n\r\nCallstack:\r\n```\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): java.lang.ClassCastException: android.widget.AbsoluteLayout$LayoutParams cannot be cast to android.view.ViewGroup$MarginLayoutParams\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5116)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.widget.FrameLayout.onMeasure(FrameLayout.java:310)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.View.measure(View.java:16497)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewGroup.measureChild(ViewGroup.java:5096)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewGroup.measureChildren(ViewGroup.java:5073)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.widget.AbsoluteLayout.onMeasure(AbsoluteLayout.java:63)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.View.measure(View.java:16497)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.widget.FrameLayout.onMeasure(FrameLayout.java:310)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.View.measure(View.java:16497)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.widget.LinearLayout.measureVertical(LinearLayout.java:695)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.widget.LinearLayout.onMeasure(LinearLayout.java:588)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.View.measure(View.java:16497)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.widget.FrameLayout.onMeasure(FrameLayout.java:310)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.View.measure(View.java:16497)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.Choreographer.doCallbacks(Choreographer.java:574)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.Choreographer.doFrame(Choreographer.java:544)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.os.Handler.handleCallback(Handler.java:733)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.os.Looper.loop(Looper.java:136)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat android.app.ActivityThread.main(ActivityThread.java:5001)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat java.lang.reflect.Method.invoke(Method.java:515)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)\r\n07-10 10:22:49.122 E/AndroidRuntime( 2225): \tat dalvik.system.NativeStart.main(Native Method)\r\n```\r\n\r\nMainActivity.cs\r\n```\r\nusing Android.App;\r\nusing Android.Content.PM;\r\nusing Android.Widget;\r\nusing Android.OS;\r\nusing Urho.Droid;\r\n\r\nnamespace Foo.Droid\r\n{\r\n    [Activity(Label = \"Test\", Icon = \"@drawable/icon\", Theme = \"@style/MainTheme\", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]\r\n    public class MainActivity : Activity\r\n    {\r\n        protected override async void OnCreate(Bundle bundle)\r\n        {\r\n            base.OnCreate(bundle);            \r\n            var mLayout = new AbsoluteLayout(this); // also tried with FrameLayout or LinearLayout\r\n            var surface = UrhoSurface.CreateSurface(this);\r\n            mLayout.AddView(surface);\r\n            SetContentView(mLayout);\r\n            var app = await surface.Show<GameEngine>(new Urho.ApplicationOptions(\"Data\"));\r\n        }\r\n        \r\n        protected override void OnResume()\r\n        {\r\n            UrhoSurface.OnResume();\r\n            base.OnResume();\r\n        }\r\n\r\n        protected override void OnPause()\r\n        {\r\n            UrhoSurface.OnPause();\r\n            base.OnPause();\r\n        }\r\n\r\n        public override void OnLowMemory()\r\n        {\r\n            UrhoSurface.OnLowMemory();\r\n            base.OnLowMemory();\r\n        }\r\n\r\n        protected override void OnDestroy()\r\n        {\r\n            UrhoSurface.OnDestroy();\r\n            base.OnDestroy();\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nGameEngine.cs  (trimmed of anything not necessary to reproduce this)\r\n```\r\nusing Urho;\r\nusing Urho.Gui;\r\n\r\nnamespace Foo\r\n{\r\n    public class GameEngine : Application\r\n    {\r\n        private Scene scene;\r\n\r\n        public GameEngine(ApplicationOptions options): base(options)\r\n        {\r\n        }\r\n\r\n        protected override async void Start()\r\n        {\r\n            base.Start();\r\n            scene = new Scene();\r\n            var testEdit = new LineEdit();\r\n            UI.Root.AddChild(testEdit);\r\n            testEdit.SetStyleAuto(null);\r\n            testEdit.Text = \"WTF\";\r\n            testEdit.SetFixedSize(600, 50);\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nFrom what I can tell the problem is that ShowTextInputTask in SDLActivity.java creates AbsoluteLayout.LayoutParams and uses that for the call to addView which gets called on the UrhoSurfacePlaceholder which uses FrameLayout as its base class.\r\n\r\nIs anybody else experiencing issues with the LineEdit on Android?  I haven't found any references to similar behavior which makes me think I'm missing something."},"comment":{"url":"https://api.github.com/repos/xamarin/urho/issues/comments/437586481","html_url":"https://github.com/xamarin/urho/issues/341#issuecomment-437586481","issue_url":"https://api.github.com/repos/xamarin/urho/issues/341","id":437586481,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzU4NjQ4MQ==","user":{"login":"hwd71","id":34234856,"node_id":"MDQ6VXNlcjM0MjM0ODU2","avatar_url":"https://avatars0.githubusercontent.com/u/34234856?v=4","gravatar_id":"","url":"https://api.github.com/users/hwd71","html_url":"https://github.com/hwd71","followers_url":"https://api.github.com/users/hwd71/followers","following_url":"https://api.github.com/users/hwd71/following{/other_user}","gists_url":"https://api.github.com/users/hwd71/gists{/gist_id}","starred_url":"https://api.github.com/users/hwd71/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hwd71/subscriptions","organizations_url":"https://api.github.com/users/hwd71/orgs","repos_url":"https://api.github.com/users/hwd71/repos","events_url":"https://api.github.com/users/hwd71/events{/privacy}","received_events_url":"https://api.github.com/users/hwd71/received_events","type":"User","site_admin":false},"created_at":"2018-11-10T14:10:16Z","updated_at":"2018-11-10T14:10:16Z","author_association":"NONE","body":"Me too!"}}
{"actor":{"display_login":"hwd71"}}