Android Question how can i duplicate images in an array

Makumbi

Well-Known Member
Licensed User
B4X:
    Activity.AddMenuItem3("", "refresh", xui.LoadBitmapResize(File.DirAssets, "ic_cached_white_24dp.png", 32dip, 32dip, True), True)
    Activity.AddMenuItem3("", "done", xui.LoadBitmapResize(File.DirAssets, "ic_done_white_24dp.png", 32dip, 32dip, True), True)
    'Dim bitmaps As List = Array("Anouncement.png", "pexels-photo-571195.jpeg", _
        '"pexels-photo-736212.jpeg", "pexels-photo-592798.jpeg")
        
    Dim bitmaps As List = Array("Anouncement.png","images2.jpg","images2.jpg")

    cursor1 = Starter.SQL1.ExecQuery("SELECT anounce FROM anouncements")
            If cursor1.RowCount > 0 Then
                For i = 0 To cursor1.RowCount-1
                    cursor1.Position = i
            Dim Phoneg As String
            Phoneg =cursor1.Getstring("anounce")
            'Log(Phoneg)
            If Phoneg=Null Then
                Return
            End If
            Log(i)
            
            Dim content As String = Phoneg
            Log(content)
            CLV1.Add(CreateItem(CLV1.AsView.Width, $"Anouncement #${i}"$, bitmaps.Get(i ), content), "")

                Next
            End If

Please help i have images in that but every time i insert a new comment in the table for anouncement i it requires me to add a new image on the list so isnt there a way of duplicating say one image so that it appears on all my anouncments automatically thanks in advance this is the error that come after adding new data in the table
B4X:
3
hullo KJS
Error occurred on line: 50 (Noticeboardanouncements)
java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
    at java.util.Arrays$ArrayList.get(Arrays.java:3769)
    at anywheresoftware.b4a.objects.collections.List.Get(List.java:117)
    at com.kccug.kabojjajuniorapp.noticeboardanouncements._activity_create(noticeboardanouncements.java:442)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at com.kccug.kabojjajuniorapp.noticeboardanouncements.afterFirstLayout(noticeboardanouncements.java:104)
    at com.kccug.kabojjajuniorapp.noticeboardanouncements.access$000(noticeboardanouncements.java:17)
    at com.kccug.kabojjajuniorapp.noticeboardanouncements$WaitForLayout.run(noticeboardanouncements.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
** Activity (noticeboardanouncements) Resume **
 

Attachments

  • Screenshot_1580104468.png
    Screenshot_1580104468.png
    95.4 KB · Views: 130
Top