获取Google搜索结果并显示在Android应用程序中

pra*_*ran 1 android google-search

我想在我的 Android 应用程序中显示谷歌搜索结果,当用户在 editText 中输入单词并单击搜索按钮以获取谷歌搜索结果并显示在我的应用程序内部时。我没有执行此操作的经验。请帮助我任何人

Hit*_*ahu 5

private static final String GOOGLE_SERACH_URL = "https://www.google.com/search?q=";
Run Code Online (Sandbox Code Playgroud)

然后只需在 URL 后面附加您想要在 google 上搜索的键,并将查询字符串加载到 WebView 中即可。

   webView = (WebView) rootView.findViewById(R.id.webView);
   webView.getSettings().setJavaScriptEnabled(true);
   webView.loadUrl(GOOGLE_SERACH_URL + searchKey);
Run Code Online (Sandbox Code Playgroud)

工作示例

https://github.com/hiteshsahu/Android-Universal-Web-Content-Loader