Android Tutorial ListView tutorial

wmardian

Member
Licensed User
Dear Manfred,
Many thanks.. i did write above code and the result is as expected :).
So there must be something wrong with my code in other project files..


Let me re-check it again :(
Thanks and Regards
 

DonManfred

Expert
Licensed User
Better Start a new thread if you encounter problems and post your project (Export as zip)
 

wmardian

Member
Licensed User
Thanks Don..
I will do it next time..
Anyway, finally i found the root cause.. i use "layout with bitmap" but i change the color on TwoLinesLayout.

Sorry to bother you..

Rgds
 

imgsimonebiliato

Well-Known Member
Licensed User
Hello,
is it possible to enlarge the bitmap?
 

DonManfred

Expert
Licensed User
B4X:
    LV.TwoLinesAndBitmap.ItemHeight = 150dip
    LV.TwoLinesAndBitmap.ImageView.Height = 140dip
    LV.TwoLinesAndBitmap.ImageView.Width = 140dip
    LV.TwoLinesAndBitmap.Label.Left = 150dip
    LV.TwoLinesAndBitmap.SecondLabel.Left = 150dip
   
    Dim cover As Bitmap
    cover.Initialize(File.DirAssets,"clipboard.png")
   
    For i = 1 To 10
    LV.AddSingleLine("Category #" & i)
        For a = 1 To 20
       
            LV.AddTwoLinesAndBitmap("Item #" & i&"."&a, "This is the second line.", cover)
        'LV.AddTwoLinesAndBitmap("Item #" & i, "This is the second line.", Bitmap1)    
      Next
  Next
 

Tayfur

Well-Known Member
Licensed User
Hello;

I add some codes for my app.

B4X:
For z=0 To kull_liste.Size-1
    'veri=kull_liste.Get(z)
    If Floor(z/2)*2=(z/2)*2 Then
        ListView1.SingleLineLayout.Label.TextColor = Colors.Yellow
        Else
        ListView1.SingleLineLayout.Label.TextColor = Colors.White
    End If
    ListView1.AddSingleLine(kull_liste.Get(z))
    DoEvents
Next


result is not good. Because; I am waiting lines colors are 1.yellow, 2 white, 3 y, 4 w, 5 y, 6w, ..... I expect that sequence,

Now; I see 1.Y 2w,3w,4y,5w,6y,7y,8y,9w,10w,...
or 1.Y,2y,3w,4w,5w,6y,7w,,8y,9y,10w......

result is every time randomly... I cant understand it.
I checked my code on debuger mode. Iit is works.
Why nort line colors sequence?
 

marylandd

New Member
helllo friends, i am new to b4a , i have some images in my sqlite, how i can create a listview with text and different image? tnx in advance
 

Alberto Iglesias

Well-Known Member
Licensed User
The ListView Control with a large number of itens WITH bitmaps from photos, got OUT OF MEMORY error.

What´s the best (or correct) way to show a image list from a folder (I got this error after some photos loaded)



B4X:
lstFiles.AddTwoLinesAndBitmap2( "text1","text2",  LoadBitmapSample(imageDir,imageFile,512,512),strFilePath)

Error in this line after some photos:

Downsampling image due to lack of memory: 4
Downsampling image due to lack of memory: 8
Downsampling image due to lack of memory: 16
Downsampling image due to lack of memory: 32
Downsampling image due to lack of memory: 64
java.lang.RuntimeException: Error loading bitmap (OutOfMemoryError)
 
Top