-2
我想要构建一个应用程序,该应用程序接收用户的短语,在网络上搜索并在结果中显示结果(因此它会更舒适地展示)。Android - 我如何开始网络搜索并获得结果到我的活动
到目前为止,我设法启动Google搜索,但无法将结果返回到我的活动。我试过StartActivityForResults
,但似乎Google搜索不支持它。 我想以URL列表的形式或类似的东西获得搜索结果,所以我可以在我的应用程序的另一个活动中打开它。有什么建议么?
这是到目前为止我的代码:
public void SearchWeb (View view) {
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
EditText editText = (EditText) findViewById(R.id.edit_message); //get text from EditText
String query = editText.getText().toString();
query = query.concat(" chords");
intent.putExtra(SearchManager.QUERY, query);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}