B4A Library [Lib, Chargeable] Amir_RecyclerView

itgirl

Active Member
Licensed User
Longtime User
Hello, I have a question about Amir_Glide
I'm trying to load a Drawable into a background of a panel with no luck.

B4X:
panel.Background =Glide.As.Drawable.LoadURL("IMG_URL")

I've even tried to double load
B4X:
panel.Background =Glide.Load(Glide.As.Drawable.LoadURL("IMG_URL").Load )
with no luck at all , The "Into" method is working with no problem but the Drawables and Bitmaps is little bit tricky.
 

asales

Expert
Licensed User
Longtime User
See this (I think will be the same approach to panel):
https://www.b4x.com/android/forum/threads/lib-chargeable-amir_recyclerview.97274/page-4#post-614479
 

itgirl

Active Member
Licensed User
Longtime User

alimanam3386

Active Member
Licensed User
Longtime User

Use this :
B4X:
Dim Glide As Amir_Glide
  Glide.Initializer.Default
  Glide.Load("URL").Listener("Glide",Img).Submit

Sub Glide_onResourceReady (Data As Object,Model As Object,DataSourceName As String,isFirstResource As Boolean) As Boolean
  Dim Img As ImageView=Sender
  Img.Background=Data
End Sub
 

Arthur Ávila

Member
Licensed User
Hi, it looks awesome! One question, how it performs with higher number of items? For example, 1000, 5000 etc.

Is there any example that maybe I missed?

Thanks.
 

alimanam3386

Active Member
Licensed User
Longtime User
Hi, it looks awesome! One question, how it performs with higher number of items? For example, 1000, 5000 etc.

Is there any example that maybe I missed?

Thanks.

Hi , it doesn't matter how many items do you have. even if you have 10 million of items.
 

sz4t4n

Member
Licensed User
Longtime User
Hello,

i have some problem with:
B4X:
Private Sub Amir_GetItemCount As Int

When I start app i dont know how many items will be in card slider co i have to check it by httjob:

B4X:
Private Sub Amir_GetItemCount As Int
   
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("someWWW")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
    End If
    j.Release
    Dim result As Int
    result = j.GetString
  
    Return result
End Sub

j.getstring return just item count for example "100"

but i get error:

B4X:
Error description: Resumable subs return type must be ResumableSub (or none).
Error occurred on line: 81 (Main)
Private Sub Amir_GetItemCount As Int

any idea how to solve it?

thanks
 

MAGAREY

Member
Licensed User
Longtime User

that's because you are trying to access to j.getstring after you release it. why dont you put the result = j.GetString inside the j.Success
?
 

sz4t4n

Member
Licensed User
Longtime User
I have changed it to:
B4X:
Private Sub Amir_GetItemCount As Int
    
    Dim result As Int
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("someWWW")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
        result = j.GetString
    End If
    j.Release
    
    
    Return result
End Sub

but there is still the same error
 

MAGAREY

Member
Licensed User
Longtime User
wait, why did you use the return for?
Sub Amir_GetItemCount As Int is declare as int
and the result as string
 

sz4t4n

Member
Licensed User
Longtime User
if i change to this:
B4X:
Private Sub Amir_GetItemCount As Int
    
    Dim result As Int
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("someWWW")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
        'result = j.GetString
        result = 10
    End If
    j.Release
    
    
    Return result
End Sub

still the same error
 

sz4t4n

Member
Licensed User
Longtime User
thanks for Your reply. When i change as You wrote there is no error while compilation but when app run there is error:

B4X:
java.lang.ClassCastException: anywheresoftware.b4a.keywords.Common$ResumableSubWrapper cannot be cast to java.lang.Integer
 

asales

Expert
Licensed User
Longtime User
When I start app i dont know how many items will be in card slider co i have to check it by httjob
Check the items online before you create the list and not in the Sub Amir_GetItemCount.
When you get the items, call the sub that creates a list.
B4X:
Private Sub CheckItems
    Dim items As Int
    Dim j As HttpJob
    j.Initialize("", Me)
    j.Download("someWWW")
    Wait For (j) JobDone(j As HttpJob)
    If j.Success Then
        Log(j.GetString)
        items = j.GetString

        CreateListWithItems(items) '-> CALL SUB TO CREATE THE LIST HERE
    End If
    j.Release
End Sub
 
Last edited:

Eldad Onojetah

Member
Licensed User
Hi

Hi,

It's the Christmas season, any promo sales? Urgently need to get this.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…