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
Little bit...
by
ASerge
[
Today
at 09:51:32 pm]
CORE-MATH 32bits in Pasca...
by
schuler
[
Today
at 09:32:39 pm]
Using Lazarus to teach In...
by
LeP
[
Today
at 07:57:48 pm]
Lazarus forum incompatibl...
by
Thausand
[
Today
at 07:16:18 pm]
Fpcupdeluxe
by
Thaddy
[
Today
at 06:12:30 pm]
FPC 3.2.4-rc1 available
by
Thaddy
[
Today
at 06:09:54 pm]
FPC Unleashed (inline var...
by
Fibonacci
[
Today
at 03:55:47 pm]
504 Gateway Timeout
by
Martin_fr
[
Today
at 03:28:06 pm]
Problem with MariaDB and ...
by
OH1KH
[
Today
at 03:26:54 pm]
Feature announcement: Fun...
by
Thaddy
[
Today
at 01:47:33 pm]
Elite Arcade
by
nomorelogic
[
Today
at 01:16:40 pm]
IDE Coolbar
by
staratel20
[
Today
at 01:00:32 pm]
Midi to Wav Converter
by
Thaddy
[
Today
at 12:28:47 pm]
Pure Pascal ZPAQ and ZSTD
by
Tomxe
[
Today
at 11:48:23 am]
AmigaOS can't run program...
by
Trenatos
[
Today
at 11:30:22 am]
Lazarus and FreePascal on...
by
jwdietrich
[
Today
at 10:44:37 am]
Space Duel
by
Tomi
[
Today
at 09:18:22 am]
Call the Llama.cpp dynami...
by
LeP
[
Today
at 09:11:38 am]
Is there a "known good" c...
by
Thaddy
[
Today
at 08:07:46 am]
Can I get the position an...
by
CM630
[
Today
at 07:29:22 am]
Lazarus 4.6 on macOS 10.1...
by
wpostma
[
Today
at 03:30:20 am]
Forums were down, and are...
by
wpostma
[
Today
at 03:26:20 am]
Untitled raycaster game (...
by
flowCRANE
[
Today
at 01:17:56 am]
Change original package o...
by
pmralbuquerque
[April 19, 2026, 07:55:14 am]
Can /my/ AI help me with ...
by
domasz
[April 19, 2026, 07:23:35 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: jListView with image (Read 891 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