Sub Globals
'Another lines
Dim Pan1 As Panel
'More lines
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Lots of lines...
Pan1.Initialize("")
Pan1.Height =100%y
Pan1.Width =100%x
Pan1.LoadLayout("principal")
Pan1.Color=Colors.ARGB(100,100,0,100)
container.AddPage(Pan1,"Kilómetros")
'More and more lines...
But I get this error:
LogCat connected to: 47900503891b10d0
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
** Activity (main) Create, isFirst = true **
java.lang.NullPointerException
at anywheresoftware.b4a.objects.ViewWrapper.setHeight(ViewWrapper.java:153)
at Kilometreador.reinier.main._activity_create(main.java:420)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:174)
at Kilometreador.reinier.main.afterFirstLayout(main.java:98)
at Kilometreador.reinier.main.access$100(main.java:16)
at Kilometreador.reinier.main$WaitForLayout.run(main.java:76)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
java.lang.NullPointerException
Dim container As AHPageContainer
Dim pager As AHViewPager
'Optionally you can use an AHViewPagerTabs object as a page indicator
Dim fixedTabs As AHViewPagerFixedTabs
I think that for the AHPageContainer you don't need to set the height nor the width.
Tha panel will automatically fill the whole surface of the AHPageContainer.
No, if I don't set the height and width, the panel is smaller than the activity and cuts some others views like buttons. If I set the width and the height, even the error, sets the panel dimensions.
In the library Pan1 width and height fit the container.
It seems that you cannot access Pan1.Width and Pan1.Height in Activity_Create.
But in Activity_Resume you can get the values of Pan1.Width and Pan1.Height and the position the views inside of Pan1 according to it's dimensions.
Attached a modified version of your test program.
EDIT:
You can also add a DoEvents at the end of Activity_Create to make sure that the viewer is initialized and add the code to reposition the other views.
Attached a second version.
Thanks Klaus.
I don't know why, but in my program doesn't works any of two solutions. I am testing my code and also I don't know why the panel don´t fit the container. I will try a while and then I will ask for help if I need it.