Reputation:
I am using action bar ,view pager and segmented controller.main screen contains actionbar with search and below action bar there is one view pager which contains 3 tabs ,each tab contains 6 segment controller tabs and each segmentd contrller tab contains one custom listview ,here is screen Scrren detials each tab contains custom listview .here i want to implement search functionality like facebook. means if user click on action bar search button one new search screen should display then if user enters search keyword it should display search results from highlighted tab data
Upvotes: 1
Views: 911
Reputation: 418
get the tab position using the method ontab listener based on the tab position we can do it easily
TO GET TAB POSITION
public void onTabSelected(final Tab tab, FragmentTransaction ft) {
tabposition = tab.getPosition();
}
USE TAB POSITION LIKE THIS searchview.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
// TODO Auto-generated method stub
if(tabposition==0)
{
//Write tab0 search here
}
if(tabposition==1)
{
//Write tab1 search here
}
if(tabposition==2)
{
//Write tab2 search here
}
return TRUE;
}
@Override
public boolean onQueryTextChange(String newText) {
// TODO Auto-generated method stub
repeat the same thinng like verifying based on positions
return true;
}
});
If u have still doubts feel free to contact me
Upvotes: 1