Android Question How to get the search results from Google Images....

StephenRM

Member
imgSearch.jpg


In Google image search, many images will be displayed for the search topic.

How to get images one by one in a list along with the URL?

Is it possible?
 

cklester

Well-Known Member
Licensed User
It's definitely possible. Start with Simple Media Manager. Make sure you understand Wait For. Then you'll just want a grid view for display (if you intend to display). I suspect a CustomListView will work perfectly for this.
 
Upvote 0

StephenRM

Member
It's definitely possible. Start with Simple Media Manager. Make sure you understand Wait For. Then you'll just want a grid view for display (if you intend to display). I suspect a CustomListView will work perfectly for this.
Thank you for your rely and time,
Is there any example that shows the extraction of images from Google Image Search?
Please.....
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
To get search results from Google Images in B4X, you will need to use the Google Custom Search API. This API allows you to search the web, including Google Images, and retrieve search results.

To use the Google Custom Search API, you will need to obtain an API key and configure a search engine. You can find more information about how to do this in the documentation for the Google Custom Search API:

https://developers.google.com/custom-search/v1/overview

Once you have an API key and have configured a search engine, you can use the HttpUtils2 library in B4X to send a request to the API and retrieve search results. Here is an example of how you might do this:
B4X:
Dim hu As HttpUtils2
hu.Initialize

Dim apiKey As String = "YOUR_API_KEY"
Dim searchEngineId As String = "YOUR_SEARCH_ENGINE_ID"
Dim query As String = "QUERY_TO_SEARCH"

Dim url As String = "https://www.googleapis.com/customsearch/v1?key=" & apiKey & "&cx=" & searchEngineId & "&q=" & query

hu.Download(url)

Wait For (hu) Complete (Result As String)
    ' Result contains the search results in JSON format
End Sub
This code sends a request to the Google Custom Search API using the HttpUtils2 library, with the specified API key, search engine ID, and search query. The Result variable will contain the search results in JSON format, which you can then parse and use in your app.

Keep in mind that the Google Custom Search API has usage limits and may require you to enable billing on your Google Cloud account. You can find more information about usage limits and billing in the documentation for the API.
 
Upvote 2

StephenRM

Member
To get search results from Google Images in B4X, you will need to use the Google Custom Search API. This API allows you to search the web, including Google Images, and retrieve search results.

To use the Google Custom Search API, you will need to obtain an API key and configure a search engine. You can find more information about how to do this in the documentation for the Google Custom Search API:

https://developers.google.com/custom-search/v1/overview

Once you have an API key and have configured a search engine, you can use the HttpUtils2 library in B4X to send a request to the API and retrieve search results. Here is an example of how you might do this:
B4X:
Dim hu As HttpUtils2
hu.Initialize

Dim apiKey As String = "YOUR_API_KEY"
Dim searchEngineId As String = "YOUR_SEARCH_ENGINE_ID"
Dim query As String = "QUERY_TO_SEARCH"

Dim url As String = "https://www.googleapis.com/customsearch/v1?key=" & apiKey & "&cx=" & searchEngineId & "&q=" & query

hu.Download(url)

Wait For (hu) Complete (Result As String)
    ' Result contains the search results in JSON format
End Sub
This code sends a request to the Google Custom Search API using the HttpUtils2 library, with the specified API key, search engine ID, and search query. The Result variable will contain the search results in JSON format, which you can then parse and use in your app.

Keep in mind that the Google Custom Search API has usage limits and may require you to enable billing on your Google Cloud account. You can find more information about usage limits and billing in the documentation for the API.
Thank you so much...

I will try the solution provided.
Am also using your ASGradient code, since a year, after completing the app, am planning to post on Playstore...
 

Attachments

  • abt.jpg
    abt.jpg
    210.4 KB · Views: 176
Last edited:
Upvote 0
Top