Java 如何在Android中将文本从Activity传递到Google Now搜索
我有一个带有编辑文本和按钮的活动。当用户按下按钮时,我需要从我的活动中启动Google Now Search,并从EditText中传递文本,以使Google Now搜索此文本。我该怎么做呢?试试这个Java 如何在Android中将文本从Activity传递到Google Now搜索,java,android,google-now,Java,Android,Google Now,我有一个带有编辑文本和按钮的活动。当用户按下按钮时,我需要从我的活动中启动Google Now Search,并从EditText中传递文本,以使Google Now搜索此文本。我该怎么做呢?试试这个 String query = editText.getText().toString(); Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.setClassName("com.google.android.googlequi
String query = editText.getText().toString();
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.setClassName("com.google.android.googlequicksearchbox", "com.google.android.googlequicksearchbox.SearchActivity");
intent.putExtra("query", query);
startActivity(intent);
您可以获得更多信息使用他们的API并在应用程序中调用,酷!这正是我需要的!非常感谢你!