Android Tutorial [B4X] Corona Cases - Cross platform Example


Data source:

Cross platform example based on B4XTable and xChart 4.70+.
Follows the same structure as explained here:
Practically all of the code is shared between the three platforms. The layouts were copied and pasted.

The project includes a default dataset in the assets folder. It tries to download an updated dataset when the app starts.

Depends on: xChart and other internal libraries.

Executable jar (Java 8 needs to be installed):

Similar example based on xCustomListView instead of B4XTable:

Download link:
Last edited:


Licensed User
Longtime User
Hopefully, all the properties available now for the left Yaxis will also be available for the right Yaxis such as text color . . .
I answered in the xChart thread, because this discussion is not really related to this thread.
Are you sure you are 75 years old and not pulling our legs?
The body yes, and fortunately I am in good health and in a good shape.
In the mind and brain I feel younger, hopefully it's not only illusion.
Last edited:


Licensed User
Longtime User
B4A 9.8
Hi Erel,
i have Download your Example ans the XChart Lib, but i dont Understand this Error....
Logger verbunden mit: 9DCDUxxxxxxxxxxxxxxx
--------- beginning of system
--------- beginning of main
Copying updated assets files (3)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Read countries data
Error occurred on line: 505 (B4XTable)
java.lang.RuntimeException: Object should first be initialized (B4XView).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(
at anywheresoftware.b4a.objects.B4XViewWrapper.asViewWrapper(
at anywheresoftware.b4a.objects.B4XViewWrapper.getTag(
at b4a.example.b4xtable._setpagelabelstate(
at b4a.example.b4xtable._clearnavigationstate(
at b4a.example.b4xtable$ResumableSub_Clear.resume(
at b4a.example.b4xtable._clear(
at b4a.example.sharedmain._preparetable(
at b4a.example.sharedmain._loaddata(
at b4a.example.sharedmain._initialize(
at b4a.example.main._activity_create(
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(
at b4a.example.main.afterFirstLayout(
at b4a.example.main.access$000(
at b4a.example.main$
at android.os.Handler.handleCallback(
at android.os.Handler.dispatchMessage(
at android.os.Looper.loop(
at java.lang.reflect.Method.invoke(Native Method)
** Activity (main) Resume **


Active Member
Licensed User
Longtime User
I get this by compiling:
B4A Version: 9.80
Java Version: 11
Parsing code.    (0.20s)
Building folders structure.    (0.03s)
Running custom action.    Error
   ROBOCOPY     ::     Robustes Dateikopieren fr Windows                             
  Gestartet: Freitag, 27. M„rz 2020 12:28:58
   Quelle : C:\sergio\B4A\examples\co\Shared Files\
     Ziel : C:\sergio\B4A\examples\co\B4A\Files\
    Dateien : *.*
  Optionen: *.* /DCOPY:DA /COPY:DAT /R:1000000 /W:30
2020/03/27 12:28:58 FEHLER 2 (0x00000002) Zugriff auf Quellverzeichnis C:\sergio\B4A\examples\co\Shared Files\
Das System kann die angegebene Datei nicht finden.

Jorge M A

Well-Known Member
Licensed User
Comment or delete to the line for ROBOCOPY command and copy the file "full_data.csv" into the files folder of your project.


Licensed User
Longtime User
In the Corona example by Erel on the first post, I tried the new feature from xChart 4.90: chart.DifferentScales=True (added by klaus) to use the 'Deaths' in the 2nd Yaxis (right) since the values are a lot smaller than the cases, but everywhere I put it in the code it hangs up the program. Where exactly does that line of code go?
Thank you

Jorge M A

Well-Known Member
Licensed User
Sub B4XTable1_DataUpdated
    For i = 0 To B4XTable1.VisibleRowIds.Size - 1
        Dim RowId As Long = B4XTable1.VisibleRowIds.Get(i)
        Dim pnl As B4XView = GraphColumn.CellsLayouts.Get(i + 1) '+1 because of header layout
        Dim ChartParent As B4XView = pnl.GetView(1)
        If RowId > 0 Then
            ChartParent.SetLayoutAnimated(0, 0, 0, pnl.Width, pnl.Height)
            ChartParent.Visible = True
            Dim Chart As xChart = ChartParent.Tag
            Chart.DifferentScales=True '<-------
            'this is only needed in B4A as the Base_Resize event will be raised automatically in B4J and B4i.
            If xui.IsB4A Then Chart.Base_Resize(ChartParent.Width, ChartParent.Height)

            Chart.AddLine("Cases", xui.Color_Blue)
            Chart.AddLine("Deaths", xui.Color_Red)
            Dim Country As String = B4XTable1.GetRow(RowId).Get(CountryColumn.Id)
            AddPointsToChart(CountriesData.Get(Country), Chart)
            ChartParent.Visible = False
        End If
End Sub


Licensed User
Longtime User
Chart.DifferentScales=True '<-------
Did it work for you where you placed it. Because I have already tried it there on a 10 inch tablet, the app locked up. I tried it on a Galaxy S6 phone, it showed the first page and locked up. Then I tried it on a Galaxy S10e phone, it showed the first page and then it locked up. Please check it out again.


Licensed User
Longtime User
The xChart library has been updated to version 5.0.
There was a problem when the min and max values of a line were the same.
You should set these two properties in the Designer, no need to do it in the code: