Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Android
»
jListView with image
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Interesting video
by
backprop
[
Today
at 07:42:40 am]
If FileExists(
by
Xenno
[
Today
at 07:16:00 am]
TDWEdit
by
Ed78z
[
Today
at 06:38:28 am]
Lazarus Bugfix Release 4....
by
jamie
[
Today
at 03:51:07 am]
Death of the Power User
by
wp
[
Today
at 01:29:18 am]
IndySecOpenSSL is now ava...
by
TheMouseAUS
[
Today
at 01:02:40 am]
Implementing an Elo ratin...
by
n7800
[
Today
at 12:44:10 am]
how to add a ForEach call...
by
mas steindorff
[June 11, 2026, 11:42:24 pm]
How to define a type of ...
by
PascalDragon
[June 11, 2026, 09:24:45 pm]
Gitlab site history date.
by
Martin_fr
[June 11, 2026, 08:46:17 pm]
Arkanoid
by
lazarusprogrammer
[June 11, 2026, 08:14:21 pm]
[New Component] ExtTabCtr...
by
d7_2_laz
[June 11, 2026, 05:01:49 pm]
Conscious Artificial Inte...
by
schuler
[June 11, 2026, 04:39:11 pm]
Pdf Viewer in Pascal
by
Tomxe
[June 11, 2026, 03:52:37 pm]
Eye Candy TESCheme
by
Dzandaa
[June 11, 2026, 11:51:52 am]
P.I.S.S. a PlugIn-framewo...
by
cdbc
[June 11, 2026, 11:35:42 am]
I found an actual use for...
by
marcov
[June 11, 2026, 11:35:23 am]
Who can explain this ?
by
J-G
[June 11, 2026, 11:30:42 am]
XLibre, finally and fortu...
by
Fred vS
[June 11, 2026, 06:20:26 am]
WEBP, no DLLs
by
Tomxe
[June 11, 2026, 04:04:37 am]
Discipline your AI coding...
by
440bx
[June 11, 2026, 02:44:06 am]
Version 4.8 was recently ...
by
Ten_Mile_Hike
[June 11, 2026, 01:43:17 am]
FPC Unleashed (inline var...
by
Fibonacci
[June 11, 2026, 12:03:13 am]
Trayslate 1.3.1 - Free tr...
by
AlexanderT
[June 10, 2026, 08:12:24 pm]
TShellListView
by
Ed78z
[June 10, 2026, 07:59:41 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: jListView with image (Read 910 times)
xinyiman
Hero Member
Posts: 2261
jListView with image
«
on:
April 06, 2023, 04:05:27 pm »
Someone explain to me how to put in a listview an image (loaded at runtime retrieved from a record in sqlite) aligned left and the text in the center.
I need it to be able to preview a series of products combined with their name. A thousand thanks
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
jmpessoa
Hero Member
Posts: 2330
Re: jListView with image
«
Reply #1 on:
April 06, 2023, 04:35:59 pm »
Hi, xinyiman!
If you can retrieve the image from a record in sqlite....
then you can try some code like theses [events]:
Code: Pascal
[Select]
[+]
[-]
procedure
TAndroidModule1
.
ListView1DrawItemBitmap
(
Sender
:
TObject
;
itemIndex
:
integer
;
itemCaption
:
string
;
out bimap
:
JObject
)
;
begin
if
itemIndex
=
1
then
//only item index = 1 has a image ...
begin
bimap
:
=
ImageFileManager1
.
LoadThumbnailFromAssets
(
'lemur_funny.png'
,
72
,
72
)
;
end
;
end
;
or
Code: Pascal
[Select]
[+]
[-]
procedure
TAndroidModule1
.
ListView1DrawItemWidgetBitmap
(
Sender
:
TObject
;
itemIndex
:
integer
;
widgetText
:
string
;
out bimap
:
JObject
)
;
begin
if
itemIndex
=
1
then
//only item index = 1 has a image ...
begin
bimap
:
=
ImageFileManager1
.
LoadThumbnailFromAssets
(
'lemur_funny.png'
,
72
,
72
)
;
end
;
end
;
«
Last Edit: April 06, 2023, 04:37:37 pm by jmpessoa
»
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
xinyiman
Hero Member
Posts: 2261
Re: jListView with image
«
Reply #2 on:
April 06, 2023, 04:49:44 pm »
I was thinking of saving images in base64 in text field. How do I then convert them to bitmaps?
Logged
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1
jmpessoa
Hero Member
Posts: 2330
Re: jListView with image
«
Reply #3 on:
April 06, 2023, 05:21:44 pm »
You can try "jBitmap component" methods:
Code: Pascal
[Select]
[+]
[-]
function
GetBase64StringFromImage
(
_bitmap
:
jObject
;
_compressFormat
:
TBitmapCompressFormat
)
:
string
;
function
GetBase64StringFromImageFile
(
_fullPathToImageFile
:
string
)
:
string
;
function
GetImageFromBase64String
(
_imageBase64String
:
string
)
:
jObject
;
// <-- try this!
Logged
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Programming
»
Operating Systems
»
Android
»
jListView with image
TinyPortal
© 2005-2018