Hi all,
I have a table on a remote MySQL Database which contains the following columns
The maximum possible number of rows in the table will be 50
I am confused regarding the view to be used for this purpose ie ListView, ScrollView OR CustomListView. Which one do you recommend ? After reading several posts, I understand that the ListView can be used if the number of Items are huge, but ListView has limited flexibility when compared to ScrollView and CustomListView. I also read that the CustomListView should be used only for displaying fewer records.
I couldn't locate a sample showing how to retrieve the image from MySQL database and displaying it on the above said ListView/ScrollView/CustomListView. I found samples showing opening an Image file from Assets folder and displaying the same image on various rows of the list.
If I have 50 rows from the Table. Do I have to DIM and initialize 50 Bitmaps for this inside the loop processing the records?
I know that in the ListView AddTwoLinesAndBitmap is to be used instead of lv.AddTwoLines, but I not clear regarding retrieving image from a blob field and then displaying it.
Please note that the column Item_Description contains a very long text approximately 300 characters.
I don't know whether I should use CustomListView or ScrollView because the Item_description is 300 characters. I also don't know how substitute the above lines to use a CustomListView or ScrollView.
Any help or sample code will be appreciated.
Regards
Anser
I have a table on a remote MySQL Database which contains the following columns
B4X:
Item_code Character(10)
Item_Description Varchar(300) 'Will contain long descriptive text
Price Decimal (10,2) 'Price of the product
Image MediumBlob ' Image of the product
The maximum possible number of rows in the table will be 50
I am confused regarding the view to be used for this purpose ie ListView, ScrollView OR CustomListView. Which one do you recommend ? After reading several posts, I understand that the ListView can be used if the number of Items are huge, but ListView has limited flexibility when compared to ScrollView and CustomListView. I also read that the CustomListView should be used only for displaying fewer records.
I couldn't locate a sample showing how to retrieve the image from MySQL database and displaying it on the above said ListView/ScrollView/CustomListView. I found samples showing opening an Image file from Assets folder and displaying the same image on various rows of the list.
If I have 50 rows from the Table. Do I have to DIM and initialize 50 Bitmaps for this inside the loop processing the records?
B4X:
For Each records() As Object In result.Rows
lv.AddTwoLines( records(result.Columns.Get("Item_Code")) , _
records(result.Columns.Get("Item_Description")) &CRLF& _
"Price : " & records(result.Columns.Get("Price")) ) ' How do I add the image here
Next
I know that in the ListView AddTwoLinesAndBitmap is to be used instead of lv.AddTwoLines, but I not clear regarding retrieving image from a blob field and then displaying it.
Please note that the column Item_Description contains a very long text approximately 300 characters.
I don't know whether I should use CustomListView or ScrollView because the Item_description is 300 characters. I also don't know how substitute the above lines to use a CustomListView or ScrollView.
Any help or sample code will be appreciated.
Regards
Anser
Last edited: