Android Question IME issues

tsteward

Well-Known Member
Licensed User
Longtime User
I have the following lines of code
B4X:
    IMEMain.Initialize("IMEMain")
    IMEMain.AddHeightChangedEvent
    'IMEMain_HeightChanged(100%y, 0) 'manually call this method to set the layout of EditText1 and btnHideKeyboard
    IMEMain.AddHandleActionEvent(ETSearch.TextField)

And I get this error but don't understand why
Logger connected to: HUAWEI LYA-L09
--------- beginning of system
--------- beginning of main
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 223 (Main)
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:5326)
at android.view.ViewGroup.addView(ViewGroup.java:5155)
at android.view.ViewGroup.addView(ViewGroup.java:5095)
at android.view.ViewGroup.addView(ViewGroup.java:5068)
at anywheresoftware.b4a.objects.IME.AddHeightChangedEvent(IME.java:119)
at lishi.assistand.tony.stewardgmail.com.main._activity_create(main.java:971)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at lishi.assistand.tony.stewardgmail.com.main.afterFirstLayout(main.java:105)
at lishi.assistand.tony.stewardgmail.com.main.access$000(main.java:17)
at lishi.assistand.tony.stewardgmail.com.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:900)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:219)
at android.app.ActivityThread.main(ActivityThread.java:8347)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1055)
** Activity (main) Resume **
 

tsteward

Well-Known Member
Licensed User
Longtime User
Yeah I know but it works in small examples. Was just hoping for some suggestions on how to track it down.
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
etsearch is a B4XFloatTextField
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
B4X:
dim edt as TextEdit = B4XFloatTextField.Textfield
IMEMain.AddHandleActionEvent(edt)
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
B4X:
dim edt as TextEdit = B4XFloatTextField.Textfield
IMEMain.AddHandleActionEvent(edt)
Thanks for that but I can't get past the line
IMEMain.AddHeightChangedEvent

Without the error above, so can't compile and don't understand why I am getting this error.
What might be causing it?
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
Okay got it figured. Had to move the IMEMain.Initialize("IMEMain") up the list further before sliding menu

Thank you
 
Upvote 0
Top