android - Loading ListViewItems Bitmaps causes crash -
android - Loading ListViewItems Bitmaps causes crash -
as title says, loading bitmaps tlistviewitems causes android apps crash. works ios, not android. image paths correct. simplicity sakes, can drop timage onto form, , manually set 1 image it, seek instead of going through loop did, set litem.bitmap := timage1.bitmap
. doing wrong? or can confirm , perchance help me out work around now.
delphi xe7 android
if menulist.items.count=0 // load menu options + icons begin := 0 length(picturepaths)-1 begin litem:=menulist.items.add; litem.text := picturenames[i]; litem.bitmap.loadfromfile(tpath.gethomepath+pathdelim+picturepaths[i]); end; end;
update
this happens if tlistview.itemappearance.item.appearance
not set 1 of options starting imagelistitem
. in situation bitmap property not assigned.
since xe7 possible have different settings controls different devices. possible have set imagelistitem
, other device listitem
, exception.
code used in sample project:
procedure tform1.speedbutton1click( sender: tobject ); var litem: tlistviewitem; limagefilename: string; begin litem := listview1.items.add; limagefilename := tpath.combine( tpath.gethomepath, 'sample.png' ); litem.text := limagefilename; // sure file exists , bitmap assigned if tfile.exists( limagefilename ) , assigned( litem.bitmap ) litem.bitmap.loadfromfile( limagefilename ); end;
link finish project source , compiled apk
android delphi delphi-xe7
Comments
Post a Comment