Start Google search query from activity - Android

后端 未结 5 1592
情书的邮戳
情书的邮戳 2020-12-14 08:42

I was wondering if there is an easier way (or any way) to start a Browser with a Google search query. For example user can select a certain word or phrase and click a button

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 09:21

    the # gave me trouble:

    Uri uri = Uri.parse("https://www.google.com/search?q="+query);
    Intent gSearchIntent = new Intent(Intent.ACTION_VIEW, uri);
    activity.startActivity(gSearchIntent);
    

提交回复
热议问题