Hi,
based in the code: https://www.b4x.com/android/forum/t...-tab-page-programmatically.78631/#post-498276
I think when delete and insert page... the RemovePage dont delete panel inside
And when insert again the Tab in a same index... get error : The specified child already has a parent
Im try to add removepanels inside index with this:
Im not sure if is correct... but dont work.... the error get is:
based in the code: https://www.b4x.com/android/forum/t...-tab-page-programmatically.78631/#post-498276
I think when delete and insert page... the RemovePage dont delete panel inside
And when insert again the Tab in a same index... get error : The specified child already has a parent
Im try to add removepanels inside index with this:
B4X:
'Return the removed page
Sub RemovePage (ts As TabStrip, Index As Int) As Panel
If ts.CurrentPage >= Index Then ts.ScrollTo(0, False)
Dim jo As JavaObject = ts
Dim p As Panel = jo.GetFieldJO("pages").RunMethod("remove", Array(Index))
jo.GetFieldJO("titles").RunMethod("remove", Array(Index))
'remove panel child inside current tab index
Dim r As Reflector
r.Target = jo.GetField("tabStrip")
Dim tc As Panel = r.GetField("tabsContainer")
tc.RemoveViewAt(Index)
RefreshTabStrip (ts)
Return p
End Sub
Im not sure if is correct... but dont work.... the error get is:
B4X:
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:5122)
at android.view.ViewGroup.addView(ViewGroup.java:4953)
at android.support.v4.view.ViewPager.addView(ViewPager.java:1485)
at android.view.ViewGroup.addView(ViewGroup.java:4893)
at android.view.ViewGroup.addView(ViewGroup.java:4866)
at anywheresoftware.b4a.objects.TabStripViewPager$B4APageAdapter.instantiateItem(TabStripViewPager.java:157)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1010)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1192)
at android.support.v4.view.ViewPager.populate(ViewPager.java:1092)
at android.support.v4.view.ViewPager$3.run(ViewPager.java:273)
at android.support.v4.view.ViewPager.completeScroll(ViewPager.java:2005)
at android.support.v4.view.ViewPager.onInterceptTouchEvent(ViewPager.java:2135)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2696)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3159)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2786)
at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:600)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1871)
at android.app.Activity.dispatchTouchEvent(Activity.java:3384)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:562)
at android.view.View.dispatchPointerEvent(View.java:12782)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5662)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5457)
Last edited: