ListView is not displaying anything but is displayed when search view is clicked <p>I have an activity named FriendListActivity which contains 3 tabs namely CHAT ,GROUP and CONTACTS.FriendListActivity contains a viewpager which is being populated through Fragments using FragmentStatePagerAdapter .Now each fragment contains a list view which is being populated using BaseAdapter .</p> <p>Following is the code of SearchView in FriendListActivity :</p> <pre><code> SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { public boolean onQueryTextChange(String query) { // this is your adapter that will be filtered Log.e("Text", query); PagerAdapter pagerAdapter = (PagerAdapter) viewPager.getAdapter(); for (int i = 0; i &lt; pagerAdapter.getCount(); i++) { Fragment viewPagerFragment = (Fragment) viewPager.getAdapter().instantiateItem(viewPager, i); if (viewPagerFragment != null &amp;&amp; viewPagerFragment.isAdded()) { if (viewPagerFragment instanceof ChatFragment) { ChatFragment chatFragment = (ChatFragment) viewPagerFragment; if (chatFragment != null) { chatFragment.beginSearch(query); // Calling the method beginSearch of ChatFragment } } else if (viewPagerFragment instanceof GroupsFragment) { GroupsFragment groupsFragment = (GroupsFragment) viewPagerFragment; if (groupsFragment != null) { groupsFragment.beginSearch(query); // Calling the method beginSearch of GroupsFragment } } else if (viewPagerFragment instanceof ContactsFragment) { ContactsFragment contactsFragment = (ContactsFragment) viewPagerFragment; if (contactsFragment != null) { contactsFragment.beginSearch(query); // Calling the method beginSearch of ContactsFragment } } } } return false; } public boolean onQueryTextSubmit(String query) { //Here u can get the value "query" which is entered in the search box. return false; } }; </code></pre> <p><strong>AdapterFriendList.java</strong></p> <p>The following code is populating the list view of ChatFragment :</p> <pre><code>public class Adapter_FriendsList extends BaseAdapter implements Filterable { private Context context; private List&lt;Bean_Friends&gt; listBeanFriends; private LayoutInflater inflater; private ApiConfiguration apiConfiguration; List&lt;Bean_Friends&gt; mStringFilterList; ValueFilter valueFilter; public Adapter_FriendsList(Context context, List&lt;Bean_Friends&gt; listBeanFriends) { this.context = context; this.listBeanFriends = listBeanFriends; mStringFilterList = listBeanFriends; } @Override public int getCount() { return listBeanFriends.size(); } @Override public Object getItem(int position) { return listBeanFriends.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View view, ViewGroup viewGroup) { Log.e("GetView", "Called"); if (inflater == null) inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (view == null) view = inflater.inflate(R.layout.feed_item_chat_list, null); //Getting Views ImageView img_friend = (ImageView) view.findViewById(R.id.imgFriend); TextView txtNameFriend = (TextView) view.findViewById(R.id.txtNameFriend); // ImageView imgMoreOption = (ImageView) view.findViewById(R.id.imgMoreoption); TextView txtFriendsID = (TextView) view.findViewById(R.id.txtFriendsID); /* imgMoreOption.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Dialog dialog = new Dialog(context); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); // hide the title bar dialog.setContentView(R.layout.more_option); dialog.show(); } });*/ //Setting values in the views //Data source of Adpater is List.At a specific position in the list ,we get Bean_Friends object Bean_Friends bean_friends = listBeanFriends.get(position); //Getting values from Bean_Friends String name = bean_friends.getName(); Log.e("FriendNAmeAD", name); String url = bean_friends.getUrl(); Log.e("urlAD", url); String extension = bean_friends.getExtension(); String friendID = bean_friends.getFriendsID(); //Initializing ApiConfiguration apiConfiguration = new ApiConfiguration(); String api = apiConfiguration.getApi(); String absoluteURL = api + "/" + url + "." + extension; Log.e("AbsoluteURLAD", absoluteURL); Picasso.with(context).load(absoluteURL).error(R.drawable.default_avatar).into(img_friend); //Loading image into the circular Image view using Picasso txtNameFriend.setText(name);//Setting name txtFriendsID.setText(friendID); return view; } public static boolean exists(String URLName) { try { HttpURLConnection.setFollowRedirects(false); // note : you may also need // HttpURLConnection.setInstanceFollowRedirects(false) HttpURLConnection con = (HttpURLConnection) new URL(URLName).openConnection(); con.setRequestMethod("HEAD"); return (con.getResponseCode() == HttpURLConnection.HTTP_OK); } catch (Exception e) { e.printStackTrace(); return false; } } @Override public Filter getFilter() { if (valueFilter == null) { valueFilter = new ValueFilter(); } return valueFilter; } private class ValueFilter extends Filter { @Override protected FilterResults performFiltering(CharSequence constraint) { String str = constraint.toString().toUpperCase(); Log.e("constraint", str); FilterResults results = new FilterResults(); if (constraint != null &amp;&amp; constraint.length() &gt; 0) { ArrayList&lt;Bean_Friends&gt; filterList = new ArrayList&lt;Bean_Friends&gt;(); for (int i = 0; i &lt; mStringFilterList.size(); i++) { if ((mStringFilterList.get(i).getName().toUpperCase()) .contains(constraint.toString().toUpperCase())) { Bean_Friends bean_friends = mStringFilterList.get(i); filterList.add(bean_friends); } } results.count = filterList.size(); results.values = filterList; } else { results.count = mStringFilterList.size(); results.values = mStringFilterList; } return results; } @Override protected void publishResults(CharSequence constraint, FilterResults results) { listBeanFriends = (ArrayList&lt;Bean_Friends&gt;) results.values; notifyDataSetChanged(); } } </code></pre> <p>}</p> <p>My problem is that when i click on CHAT tab,nothing is displayed but when i click on SearchView presented on the Activity containing the chat tab,the contents of list view are displayed .I want the contents of CHAT tab to be displayed when the user press of swipe the screen.Please help me to fix the issue.</p>