Android Question Tableview upsets Customview

Richard O'Sullivan

Member
Licensed User
Hi All,

I'm trying to use a DatePicker in an Activity together with a TableView. My problem is that the Table changes the operation of the DatePicker.

I've added the datePicker as a Customview in the Designer.

I can only add a TableView through code - why?

When I do add the Table view the datePicker half-disappears.

Any help greatly appreciated.

Richard
 

Richard O'Sullivan

Member
Licensed User
Thanks Erel for coming back to me.

The attached export will demo the Date Picker working but when you uncomment the Table section of code the screen displays differently.

I'm trying to use the DatePicker to select a new datefield and then have the Table refresh with the new date Range.

Richard
 

Attachments

  • ADPtest.zip
    15.9 KB · Views: 159
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Works fine here:

SS-2018-05-17_10.14.38.png


Tip:
Change your code to:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   DateTime.DateFormat = "dd/MM/yyyy"
   DateFm.Date = DateTime.DateParse("01/05/2018")
   AddTable
End Sub

Sub AddTable
   Table1.Initialize(Me,"Table1",4)
   Table1.FontSize = 25
   Table1.HeaderFontColor = Colors.Cyan
   Table1.AddToActivity(Activity,0dip,250dip,480dip,700dip)

   Table1.SetHeader(Array As String("Col1","Col2","Col3","Col4"))
   For i = 0 To 5000
       Table1.AddRow(Array As String("Row: " & i, "ccc", "ddd", "eee"))
   Next
   Table1.SetColumnsWidths(Array As Int(100dip, 100dip, 120dip, 100%x - 260dip))
End Sub
It will run much faster in debug mode.

You haven't posted a screenshot so I can only guess that the Table hides the ADP panel. Try to call AddTable before you load the layout. This way the panel will be added above the table..
 
Upvote 0

Richard O'Sullivan

Member
Licensed User
Thanks Erel - that worked much better.

I thought the LoadLayout needed to be called first and then the Table added afterwards - but no. I tried to keep the Table Layout on a different part of screen. I'm not sure I fully understand the heirarchy.

Thanks for your prompt answer and useful tips.

Richard
 
Upvote 0
Top