Reputation: 511
I try to find a method for setting text for SearchView but I can't find anything? does any one know any method for doing this ? for example something like this
searchView.setText("blah blah");
Upvotes: 2
Views: 3442
Reputation: 3190
//1st activity
Intent intent=new Intent(view.getContext(), 2ndActivity.class);
intent.putExtra("key", someValue);
startActivity(intent);
//2nd activity
String value="";
Intent intent=getIntent();
Bundle bundle=intent.getExtras();
if(bundle!=null)
{
mealId=bundle.getString("key");
}
Since you had get value in 2nd activity, other things are simple.
Upvotes: 0
Reputation: 69689
try this use setQuery
setQuery(CharSequence query, boolean submit)
Sets a query string in the text field and optionally submits the query as well.
sample code
send title to other activity using intent
Intent intent=new Intent(this, OtherActivity.class);
intent.putExtra("TITLE", "NILESH");
startActivity(intent);
Retrive title in other activity like this
String str = getIntent().getStringExtra("TITLE");
searchView.setQuery(str, false);
Upvotes: 5