0

I am trying to implement an EditText which takes a url from user and loads the desired url in the webview. I have accomplished this task. Now I want to provide corresponding suggestions of urls on typing a word in the EditText same like as Google provides. I have a sample application from google play store which has implemented this scenario.

URL to the app: https://play.google.com/store/apps/details?id=video.downloader.videodownloader&hl=en

I have searched every where to find a clue to start my work. But I couldn't find anything supportive.

Screen Shots for figuring out the Scenario:

Screen Shot

Screen Shot

Screen Shot

I am not using any database to fetch data from and to show in suggestion. I want to use EditText like an address bar of Google browser. When a user tap and type any word, it gives suggested urls respectively as showing in the screen shots.

halfer
  • 18,701
  • 13
  • 79
  • 158
Hami Khan
  • 1
  • 2
  • 3
    see https://stackoverflow.com/a/19860624/2252830 – pskink Nov 15 '18 at 07:56
  • How would we use this piece of code to search in google urls..? As its getting suggestions from wikipedia. I changed the url with "https://www.google.com" inside String urlString and run again the app. Its not showing any suggestion. Thanks for your notice.. – Hami Khan Nov 15 '18 at 08:38
  • this is your job to provide your data - i have no idea where you want to get suggestions from... – pskink Nov 15 '18 at 08:39
  • Kindly, check screen shots. It will give you an idea about figuring out my question. – Hami Khan Nov 15 '18 at 11:08
  • did you run my code **without** any changes (just **^C** and **^V**)? does it look sinilar? if so, the only thing you have to do is to access your custom `Uri` and get the suggestions from that `Uri` – pskink Nov 15 '18 at 11:10
  • Yes, I did run it. It looks comparable. – Hami Khan Nov 15 '18 at 11:22
  • so i hope you know what to do next – pskink Nov 15 '18 at 11:23
  • What do you mean by accessing custom uri?? – Hami Khan Nov 15 '18 at 11:24
  • where do you want to get your searching suggestions from? from some `Uri`, right? so you have to access that `Uri` and parse the `json` / `xml` / `whatever` response – pskink Nov 15 '18 at 11:30
  • I want to retrieve suggestion from Google Custom Search. Custom Search JSON API. How would I use it over here? See this : " https://developers.google.com/custom-search/v1/overview " – Hami Khan Nov 15 '18 at 11:38
  • so use `Google Custom Search` instead of `https://en.wikipedia.org/w/api.php` which i used to get my suggestion from – pskink Nov 15 '18 at 11:38
  • Can you kindly show me, what exactly should I do? – Hami Khan Nov 15 '18 at 11:42
  • what is your `Google Custom Search` uri? for example in my case if you search for string `europe` the uri is: https://en.wikipedia.org/w/api.php?action=opensearch&search=europe&limit=8&namespace=0&format=json – pskink Nov 15 '18 at 11:43
  • Have you checked the screen shots I uploaded? – Hami Khan Nov 15 '18 at 12:12
  • By Google Custom Search I mean Custom Search JSON API The Custom Search JSON API lets you develop websites and applications to retrieve and display search results from Google Custom Search programmatically. With this API, you can use RESTful requests to get either web search or image search results in JSON format. Read this: https://developers.google.com/custom-search/v1/overview – Hami Khan Nov 15 '18 at 12:17
  • Yeah, I will try to follow all the explanations. Thank you for your kind informations. – Hami Khan Nov 15 '18 at 12:25
  • Possible duplicate of [EditText with suggestion list below](https://stackoverflow.com/questions/4903763/edittext-with-suggestion-list-below) – Nicola Gallazzi Mar 05 '19 at 15:54

1 Answers1

0

I would use a search interface (documentation here: https://developer.android.com/guide/topics/search/) with a Content Provider. You should fill the content provider by using custom search JSON API https://developers.google.com/custom-search/v1/overview. It's a quite complicated task but I think you should start with this stack

Nicola Gallazzi
  • 5,552
  • 4
  • 24
  • 44
  • I think your answer can help me. But I couldn't follow your suggestion. Can you help me what exactly should I do, to come with solution? Thanks for your kind suggestion. – Hami Khan Nov 15 '18 at 11:11