I have a RecyclerView getting external JSON data parsed from a server. It works fine however the Volley async task on JSON sometimes takes a while and when it does the fragm
You can do it using interface callback:
public interface OnAdapterCountListener {
void onAdapterCountListener(int count);
}
private OnAdapterCountListener onAdapterCountListener;
public void setOnAdapterCountListener(OnAdapterCountListener l) {
onAdapterCountListener = l;
}
onAdapterCountListener.onAdapterCountListener(getItemCount());
listAdapter.setOnAdapterCountListener(new OnAdapterCountListener() {
@Override
public void onAdapterCountListener(int count) {
if (count > 0)
adapterEmptyText.setVisibility(View.GONE);
}
});