According to this link: ListFragment android developers
I want to set my custom layout for list, but it makes exceptions.
Here is the code:
p
I just needed to change my empty text TextView
properties and did this
@Override
public void onLoadFinished(Loader loader, Cursor cursor) {
// Swap the new cursor in. (The framework will take care of closing the
// old cursor once we return)
mAdapter.swapCursor(cursor);
if (cursor.getCount() == 0) {
setEmptyText(getString(R.string.no_users));
TextView tvEmpty = (TextView) getListView().getEmptyView();
tvEmpty.setTextColor(getResources().getColor(R.color.blue));
}
// The list should now be shown.
if (isResumed()) {
setListShown(true);
} else {
setListShownNoAnimation(true);
}
}
Do not forget that if you try initializing tvEmpty
before you call setEmptyText("Empty")
, you'll run into a NullPointerException