I want to search a string on Google and have the results shown in another page of my activity.
My code for searching right now is:
Button breakfast = (Button) findViewById(R.id.breakfast);
breakfast.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
// Intent myIntent = new Intent(view.getContext(), Main5Activity.class);
// startActivityForResult(myIntent, 0);
try {
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
String term = Main2Activity.choice + " breakfast recipe using " + Main3Activity.list;
intent.putExtra(SearchManager.QUERY, term);
startActivity(intent);
} catch (Exception e) {
// TODO: handle exception
}
}
});
However, right now it is set up so that when the code runs it uses an outside google app to search and then uses that app to display results. I want to search still inside of my app and display the results in the next activity(Main5Activity). As you can see, the Main5Activity is already set up but I commented it out because I am not sure how to implement this.
This is the scrollview I want the results to be displayed in:
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
</ScrollView>
I am new to Google API, so using an outside app to google search was all I could do. Any help is greatly appreciated.