Skip to first unread message

Michel

unread,
Jan 30, 2019, 10:52:26 AM1/30/19
to MIT App Inventor Forum
Hi,

using the ActivityStarter, I can show the list of images corresponding to a specific request. for example Boletus edulis will return a huge number of available pictures

I would like to display ONLY the first image. Is it possible? How?

Thanks

SteveJG

unread,
Jan 30, 2019, 11:30:27 AM1/30/19
to MIT App Inventor Forum
A way to search using Wikipedia (not using ActivityStarter)  is here  Wikipedia API      The items searched can be limited to one in the code.  Type your mushroom name and you will find an article but not an isolated image, if that is what you are looking for.

mushroom.jpg




You might share your Blocks with the Forum so others can see what you are trying to do Michel to show how you are searching for images.

Regards,
Steve

Michel

unread,
Jan 30, 2019, 12:11:14 PM1/30/19
to MIT App Inventor Forum
Unfortunately, Steve, this is not useful for me.
Here is my screen

Capture plein écran 30.01.2019 180339.bmp.jpg

My desire is to show the first image, just to give an idea of the aspect, with no scientific goal

SteveJG

unread,
Feb 1, 2019, 8:59:53 PM2/1/19
to MIT App Inventor Forum
You probably can search and display a single image doing a Custom Google Search  A Custom Google Search api produces an xml file that has to be parsed to get the url of the image you search. You might be able to do the 'search' from a WebViewer  or possibly the Web component to capture the xml file that displays the search result. You can set limits to the number of images that are displayed; if you only want one, you get one.  If you are successful, an App Inventor Image control can be set to that url to display your image (the search results provides the full url path to the searched image).

You need to experiment as there are no examples showing how to do this with AI2  See  https://developers.google.com/custom-search/docs/overview#available_apis    for Google's terms and a description of what the api does... You need an api key.   The following explains how to search and restrict the search to a single image  https://developers.google.com/custom-search/docs/xml_results#xml-results-for-image-search-queries .;.  Parse the xml and then display that image in an Image control by setting the Picture to the url address.

Does this work with App Inventor?  Possibly.   Let us know what you discover.  Others certainly would be interested in this.


If you explained how you do "using the ActivityStarter, I can show the list of images corresponding to a specific request. for example Boletus edulis will return a huge number of available pictures" and what the results look like; someone might be able to show you how to limit the search.   I am only aware of doing  an ACTION_Web_SEARCH   and using terms  QUERR,term       where term is you mushroom.



Regards,
Steve








TimAI2

unread,
Feb 2, 2019, 4:46:21 AM2/2/19
to MIT App Inventor Forum
Reply all
Reply to author
Forward
0 new messages