title: How to dynamically change text of empty view in listfragment
body: <p>I have red many solutions regarding this but none of them solved my problem.
  What i want to do is, when my list view is empty its ok if the default empty text view shows up (which is declared in xml) but what if i want to change its text at some point in an activity that extends listfragment according to my need and make it visible....
  Recently i tried this:</p>
  
  <pre><code>public void setEmptyText(CharSequence emptyText) {
      ListView mListView = (ListView) NotificationsView.findViewById(android.R.id.list);
      View emptyView = mListView.getEmptyView();
          ((TextView) emptyView).setText(emptyText);
  }
  </code></pre>
  
  <p>It doesn't give any error but it is not solving the problem too. Any Help would be appreciated thanks</p>
  
  <p><strong>EDIT:</strong>
  here is my layout of listfragment</p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/container"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:ignore="MergeRootFrame" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:gravity="center_vertical|center_horizontal"
          android:orientation="vertical" &gt;
  
          &lt;ListView
              android:id="@id/android:list"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/fragment_bg"
              android:divider="@null"
              android:dividerHeight="1dp"
              android:listSelector="@drawable/list_style" &gt;
          &lt;/ListView&gt;
  
          &lt;TextView
              android:id="@id/android:empty"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="@color/fragment_bg"
              android:text="No data" /&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/android.support.v4.widget.SwipeRefreshLayout&gt;
  </code></pre>