B4A Library [Library] B4aGridView v3.80

Shahid Saeed

Active Member
Licensed User
Longtime User

Great, cannot wait to test it. Many Thanks...
 

Shahid Saeed

Active Member
Licensed User
Longtime User
@lonleystar

Regarding Text Positioning:-
Can We have Text_Bottom_Outside

And the following is the result of other positions:-

Text_Bottom_Inside: Displaying the Text Center Inside
Text_Center_Inside: Displaying Correctly Center Inside
Text_Top_Inside: Displaying The Text Center Inside
Text_Top_Outside: Displaying Correctly Top Outside
 

Shahid Saeed

Active Member
Licensed User
Longtime User
I am loading contents through JSON Parser, and the Text is also coming throug it. I have tried your method of SetText with for loop but It is just loading text of last item and displaying the same on all items.

B4X:
For Each col_albums As Map In albums
        'Dim album_id As String = col_albums.Get("album_id")
        Dim album_image As String = col_albums.Get("album_image")
        Dim album_title As String = col_albums.Get("album_title")
       
    GridView.AddImageFromWeb(album_image)
    For n = 0 To col_albums.Size
    GridView.SetText(n, album_title)   
    Next    
Next
 

Shahid Saeed

Active Member
Licensed User
Longtime User

Ok I have fixed it the following code did the magic:

B4X:
For Each col_albums As Map In albums
        alb_row = alb_row +1
        'Dim album_id As String = col_albums.Get("album_id")
        Dim album_image As String = col_albums.Get("album_image")
        Dim album_title As String = col_albums.Get("album_title")
       
    GridView.AddImageFromWeb(album_image)
    'For n = 0 To col_albums.Size   
    GridView.SetText(alb_row, album_title)   
    'Next
    's = Array As String(album_image)   
    Next

But Still Text Positioning needs to be fixed
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi Shahid, please when U find an issue make a photo and post it so I understand which issue it is.

For the empty_photo & ic_error they are stored in the Library if U want use this one, if U want use Your one just set this 2 command below with Your icons.

GridView.SetImageOnLoading = "Your_Icon.png"

GridView.SetImageOnFail = "Your_Icon.png"
 

stanks

Active Member
Licensed User
Longtime User
some err running your example (no code change)

B4X:
java.lang.OutOfMemoryError


    at android.graphics.Bitmap.nativeCreate(Native Method)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:810)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:787)
    at android.graphics.Bitmap.createBitmap(Bitmap.java:754)
    at it.giuseppe.salvi.gridview.library.core.utility.bitmap.RoundedDrawableWrapper.drawableToBitmap(RoundedDrawableWrapper.java:112)
    at it.giuseppe.salvi.gridview.library.core.adapter.GridViewAdapterWrapper.addBorderToBitmap(GridViewAdapterWrapper.java:279)
    at it.giuseppe.salvi.gridview.library.core.adapter.GridViewAdapterWrapper$1.onLoadingComplete(GridViewAdapterWrapper.java:236)
    at com.nostra13.universalimageloader.core.DisplayBitmapTask.run(DisplayBitmapTask.java:74)
    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:5140)
    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:795)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:611)
    at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132)
    at dalvik.system.NativeStart.main(Native Method)
 

Mrjoey

Active Member
Licensed User
Longtime User

u should use
B4X:
GridView.CacheInMemory = False
    GridView.CacheOnDisk = True
and
B4X:
GridView.ClearMemoryCache
GridView.ClearDiskCache
on every GridView.AddImageFromWeb or whatever call

notice that outofmemory error will be raised on lack of memory by meaning ur app is exceeding the limit of the heap size wish is 64mb , if u believe that ur app is heavy u should add a permission (SetApplicationAttribute(android:largeHeap, "true")) , and try to remanage ur layouts try to find wish activity or objects or any bitmaps are heavy and fix them
 

Shahid Saeed

Active Member
Licensed User
Longtime User
Here you Go:


This Image is Text_Bottom_Inside and you can see the text is in the middle instead of bottom


This Image is Text_Top_Inside and you can see still text is in the middle instead of Top


This Image is Text_Top_Inside with Text Background and you can see the Background is covering whole image.


This Image is Text_Top_Outside with Text Background enabled and it works as it shoule be
 

deltacode

Member
Licensed User
Longtime User
I like the look of this library but can i ask for a new option.

I would like to add a bitmap, not a file from a directory or the web, but one i already have open, so a new method like AddBitmap

B4X:
for x = 1 to 4
 Dim bmp As Bitmap
 Dim draw As BitmapDrawable = objDraw
 bmp.Initialize3(draw.Bitmap)

 GridView.AddBitmap(x, bmp)
 GridView.SetText(x,"Bitmap " & x)
next

so i can basically add my own bitmap with its own text at the position specified.

Would this be possible, if so you will save me so much work as i was about to write my own grid as i can not find anything close to what i want until i found your library.

Many Thanks
 

deltacode

Member
Licensed User
Longtime User
also to add to my request i have found a bug.

add 2 gridviews to two different panels, both are initialized with 2 different names

use SetText and it changes the text to the same in both gridviews
 

Shahid Saeed

Active Member
Licensed User
Longtime User
also to add to my request i have found a bug.

add 2 gridviews to two different panels, both are initialized with 2 different names

use SetText and it changes the text to the same in both gridviews
This bug is not limited to Panel, It is also there with 2 different activities. The text provided for 1st activity also replaces the text on other activity's text(s).
 

Shahid Saeed

Active Member
Licensed User
Longtime User
I am sure @lonleystar will be able to do it, because already we have option(s) to add image at specified position using the following calls:

B4X:
GridView.AddImageAt(x, dir, File)
GridView.AddImageFromWebAt(x, url)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…