I have read the answer "How do I launch a URL in the browser from my Application on Android" but I am still confused.
------> Basically I have a TextView that will be displaying different names of famous people, and what I want is, to perform a google search in the browser that searches for the text that is currently displayed in the TextView, when the user clicks on the TextView itself.
Thanks.
in onClickListner event write this code:
String url = textView.getText().toString();
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
Well, what I understand is that you want to launch Google search for the text when you click on the TextView. Here is a code to directly launch Google search of the text provided:
String searchKey = "Text From your TextView";
Intent search = new Intent(Intent.ACTION_WEB_SEARCH);
search.putExtra(SearchManager.QUERY, searchKey);
startActivity(search);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With