Delphi Berlin: FMX-TListView, switching between Windows & Android
<p>I've created an app in Delphi 10.1 Berlin using Windows as the Master View. I dropped a TListView on the form and customized it using the new Toggle Design Mode. I added a TImageObjectAppearance and several TTextObjectAppearance items. I added code to set the image for the TImageObjectAppearance and the text items have various font sizes and style. I also have 3 TImage components on the form that I use to assign to the TImageObjectAppearance.Bitmap based on a value.</p>

<p>When I compile it for Win32 and run it eveything looks great. The bitmap images display based on the value on each row of the TListView. When I switch the Style to Android and the View to Android 10" Tablet the IDE throws this error:</p>

<p>"Cannot assign a TAppearanceObjectItem to a TAppearanceObjectItem."</p>

<p>The View still says Android 10" Tablet but the actual view on the form is still a Windows form. So my first question is what the heck is that error all about? I thought Delphi was supposed to be able to compile to all these different targets/devices using the same code. That's certainly not happening. But wait, there's more...</p>

<p>So I switched back to Style: Windows and View: Master. I clicked on the TImageObjectAppearance item on the form and pressed the Delete key and I got this error:</p>

<p>"Cannot delete a persistent reference from the designer."</p>

<p>But if you click on the item in the Structure window and press Delete it deletes just fine. Bug? I would say so. Anyway, there's more.I deleted the TImageObjectAppearance item from the Structure window and then switched back to Style: Android and View: Android 10" Tablet and guess what...I get the same error. But there is not TImageObjectAppearance on the form! So I completely delete the TListView custom items in Windows | Master view and start fresh using Android 10" Tablet view. I add all the custom appearance objects, including the TImageObjectAppearnce.But when I compile it for a 10" Android tablet and run it on my Galaxy Tab S2, 1) No images appear.Here's the code I wrote to set the images. (There are 3 TImage components on the form that I use for the TImageObjectAppearance items.) This code works just fine when compiling for Win32.</p>

<pre><code>function TdmVisual.AddOrUpdateItem(AItem: TListViewItem; AMGDL: Integer): TListViewItem;
var
  LObject: TListItemImage;

begin
  Result         := AItem;
  LObject        := Result.Objects.FindObjectT&lt;TListItemImage&gt;('imgRating');
  LObject.Bitmap := TBitmap.Create;

  if AMGDL &lt; 70 then
    LObject.Bitmap.Assign(fmMain.iLow.Bitmap)
  else if (AMGDL &gt;= 70) and (AMGDL &lt;= 130) then
    LObject.Bitmap.Assign(fmMain.iGreen.Bitmap)
  else if (AMGDL &gt; 130) and (AMGDL &lt;= 180) then
    LObject.Bitmap.Assign(fmMain.iYellow.Bitmap)
  else
    LObject.Bitmap.Assign(fmMain.iRed.Bitmap);
end;
</code></pre>

<p>My second (3rd or 4th) question is why does the above code not work when compiling for Android and what's the proper way to assign images to a TImageObjectAppearance in code?</p>

<p>Thanks
-Barry</p>