@Override public View onCreateView( LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View v = inflater.inflate(R.layout.frag_tab_trend, container, false); listView = (ListView) v.findViewById(R.id.tab_trend_list); trendDataSource = new TrendDataSource(getActivity().getApplicationContext()); Date today = MyApplication.getTodayDate(); String order = DbTrend.COLUMN_COUNT + " DESC"; String limit = "50"; trendDataSource.open(); trendList = trendDataSource.getTrendsByDate(limit, order, today.getTime()); trendDataSource.close(); adapter = new FragTabTrendsAdapter( getActivity().getApplicationContext(), inflater, R.layout.frag_tab_trend_item_row, trendList); listView.setEmptyView(v.findViewById(R.id.emptyElement)); listView.setAdapter(adapter); return v; }