I developed one list view with search bar,so i want to open new activity after clicking on specific search item.
Asked
Active
Viewed 1,213 times
-6
-
2please edit your question and read http://stackoverflow.com/help/how-to-ask – Yagami Light Feb 06 '17 at 08:42
-
did you try `@Override public void onItemClick(AdapterView> parent, View view, int position, long id) { }` ?!? – Yagami Light Feb 06 '17 at 08:43
-
1Possible duplicate of [How can i start a different activity on item click from a custom listview?](http://stackoverflow.com/questions/26842916/how-can-i-start-a-different-activity-on-item-click-from-a-custom-listview) – Ankush Bist Feb 06 '17 at 08:44
2 Answers
1
You can search on a listview
and you can use OnItemClickListener
From search view
new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextChange(String newText) {
if (TextUtils.isEmpty(newText)) {
mListView.clearTextFilter();
} else {
mListView.setFilterText(newText.toString()); //you can use this to filter items
}
return true;
}
@Override
public boolean onQueryTextSubmit(String query) {
return true;
}
}
And in Listview
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//put some intent
}
}
For going to new Activity use this
Intent intent=new Intent(getBaseContext(),TargetActivity.class);
startActivity(intent);
refer

Community
- 1
- 1

Kiran Benny Joseph
- 6,755
- 4
- 38
- 57
0
In your adapter class you have search bar. On that you can use search bar and transfer to another activity
searchView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(CurrentActivity.this, NextActivity.class);
startActivity(intent);
}
});

Sasi
- 445
- 4
- 19