Android Question Remove all images from gridview

Douglas Farias

Expert
Licensed User
Longtime User
Hi i m using the B4aGridView to get a list of images of the web.
Ok.

this is working show the images on the app but i dont know how to remove from the screen.
i m want to show only 4 images on the screen like imagedownloader sample, when press a button show 4 diferent photos, press again clear the 4 current photos and add new 4 photos etc

i m trying to use this code to get all views and clear this, i think the code is correct but i have error all time *-*
here is the code
B4X:
If    GridView.Length > 0 Then
    For i=0 To  GridView.Length - 1
    GridView.RemoveAt = i
    Next
    End If

The error log
4 Photos
java.lang.IndexOutOfBoundsException: Invalid index 2, size is 2
at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
at java.util.ArrayList.remove(ArrayList.java:403)
at it.giuseppe.salvi.gridview.library.core.adapter.GridViewAdapterWrapper.Remove(GridViewAdapterWrapper.java:182)
at it.giuseppe.salvi.gridview.library.core.GridViewActivityWrapper.setRemoveAt(GridViewActivityWrapper.java:848)
at click.fight.vallow.telaprincipal._jobdone(telaprincipal.java:3348)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.keywords.Common$5.run(Common.java:952)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5086)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)

what can i make to clear the 4 images at the grid and add 4 diferent new photos?
http://www.b4x.com/android/forum/threads/library-b4agridview-v3-30.24965/
 
Top