TableView GetItem and Android

Subject : TableView GetItem and Android

I have a TMSFMXTableView on the form. My code has worked successfully under Windows.

The first time it ran under Android it crashed in GetItem in Unit FMX.TMSTableView.

function TTMSFMXTableViewItems.GetItem(
  Index: Integer): TTMSFMXTableViewItem;
  Result := TTMSFMXTableViewItem(inherited Items[Index]);

The calling unit is attempting to remove all the design time rows:

  {Remove any design time rows}
  for iIterate := tviewBillingPeriod.Items.Count - 1 downto 0 do

This does work under Windows.

Would you know what changes do I need to make for it to work under Android?

  Peter Evans

I have now tried:-

  TableViewItem       :  TTMSFMXTableViewItem;

for iIterate := tviewBillingPeriod.Items.Count - 1 downto 0 do begin
    TableViewItem := tviewBillingPeriod.Items[iIterate];

Got same problem.
There is one event on the TableView.
So I also coded :-

tviewBillingPeriod.OnItemSelected := Nil;
tviewBillingPeriod.OnItemSelected := tviewBillingPeriodItemSelected;

Unfortunately I got same problem.

I have had to delete all the Design Time rows. This solution works.

However I do not like this approach. It still want to delete the Design Time rows programmatically.


Can you Try to use a DisposeOf instead of a Destroy?

Thank you.
Using DisposeOf worked under Android.