I have an empty view which I set via the ListView object that I have created. The issue that I'm facing is that even when the list is populated, the empty view is still shown and not the populated list view (I've tried removing the empty view and it works correctly).
Here's the code for the xml layout of the activity where I have the ListView and empty view(they're in a relative layout):
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/requests_list"
/>
<TextView
android:id="@+id/no_requests_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="No current requests"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
android:fontFamily="sans-serif-smallcaps"
android:visibility="gone"
/>
Here's how I set the empty view:
View emptyView = findViewById(R.id.no_requests_textView);
RequestAdapter requestAdapter = new RequestAdapter(this, requestDetailsArrayList);
ListView requestsListView = (ListView) findViewById(R.id.requests_list);
requestsListView.setAdapter(requestAdapter);
requestsListView.setEmptyView(emptyView);
Does anyone know what the issue is?
Thanks in advance!