B4A Class ImageInternetChooser: pick image icon up from Internet directly

peacemaker

Well-Known Member
Licensed User
End-users of some apps may need to choose small icons to save it into app's database.
But there was no tool to choose a needed icon in 2-3 taps, but the Internet is always under finger.
It seems, now it's possible.

No fully free services with API for image searching, with good big database, so... i invented the max universal way :)

I have made the class that helps
  • to search pictures by a needed URL
  • choose the needed icon
  • get it into your app.
Dependencies:
  • OkHTTPUtils2
  • StringUtils
  • WebViewExtras, WebViewExtras2, WebViewSettings
Video: Class is in the project .ZIP file.
Comments, fixes and updates are welcome.

 

Attachments

Last edited:

peacemaker

Well-Known Member
Licensed User
If it might be interesting - the separate "Internet Image Picker" provider app is also developed, in the 1st post.
App works as:
  • image grabber from Internet
  • gallery of the grabbed images
  • image sharing provider for other apps
 

andyr00d

Member
Licensed User
I've implemented a similar solution using the free Pixabay API:

B4X:
Dim API_KEY As String = "XXXXX"
        Dim res As String
        Dim GetImageJob As HttpJob
        GetImageJob.Initialize("GetAddress", Me)
        GetImageJob.Download("https://pixabay.com/api/?key=" & API_KEY & "&q=" & imgString & "&image_type=illustration&safesearch=true&pretty=true")
        Wait For (GetImageJob) JobDone(GetImageJob As HttpJob)
        If GetImageJob.Success Then
            Dim jp As JSONParser
            jp.Initialize(GetImageJob.GetString)
            Dim m As Map = jp.NextObject
            Dim results As List = m.Get("hits")
            If results.Size > 0 Then
                Dim first As Map = results.Get(0)
                res = first.Get("webformatURL")
                Log(res)
                'update ivMain with image
                SetImage(res, imgString)
            End If
        End If
        GetImageJob.Release
You can get more information on the API parameters here
 
Top