2

There is an activity with ImageView inside. I want to get the first image of google image search and place it as image source. i think it is possible, i found something similar on a translation application.

Is there any api available for this ?

Mehdi Nazari
  • 113
  • 2
  • 13

1 Answers1

2

You should check Google Custom Search API, that alows filter by type

https://developers.google.com/custom-search/json-api/v1/reference/cse/list

The request will be something like

https://www.googleapis.com/customsearch/v1?googlehost=google.co.uk&safe=medium&searchType=image&key={apikey}&cx={cseId}&q={search}

See more here https://lornajane.net/posts/2013/doing-google-custom-search-via-api

To use the images as a source, you can use Picasso Lib

cesarsicas
  • 437
  • 1
  • 5
  • 17
  • your answer woks for me. only remember there is an option for image search in CSE and that option must be on yes (default is no unfortunately). – Mehdi Nazari May 28 '17 at 14:57