title: How to hide Linear layout when ListView data is empty?
body: <p>I want to hide whole Linear layout when listview is empty?
  I tried setEmptyView but that thing i dont needed. </p>
  
  <p>Here my listView code :-</p>
  
  <pre><code>  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
      View view = inflater.inflate(R.layout.activity_notification_task, container, false);
      listschedule=(ListView)view.findViewById(R.id.notificationtaskschedule);
      LinearLayout schduletasks=(LinearLayout)view.findViewById(R.id.sch);
       new pendingscheduletask().execute();
           return view;
  }
  //daily task pending
  private class pendingdailytask extends AsyncTask&lt;Void, Void, Void&gt; {
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
          mProgressDialog = new ProgressDialog(getActivity());
          mProgressDialog.setTitle("Please Wait");
          mProgressDialog.setCancelable(false);
          mProgressDialog.setMessage("Loading...");
          mProgressDialog.setIndeterminate(false);
          mProgressDialog.show();
      }
      @Override
      protected Void doInBackground(Void... args) {
          try {
              arraylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
              List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
              params.add(new BasicNameValuePair("username", suid));
              JSONObject json = jParser.makeHttpRequest(url_psendingdailytask, "GET", params);
  
              int success1 = Integer.parseInt(json.getString("success4"));
              Log.d("success4", json.toString());
              if (success1 == 0) {
                  Snackbar.make(view, "Not Data Found", Snackbar.LENGTH_LONG).show();
              }
              if (success1 == 1) {
                  ownerObj = json.getJSONArray("daily");
                  for (int i = 0; i &lt; ownerObj.length(); i++) {
                      jsonobject = ownerObj.getJSONObject(i);
  
                      daily_task_name.add(jsonobject.getString("t_tname"));
                      daily_task_time.add(jsonobject.getString("t_time"));
                      daily_task_detail.add(jsonobject.getString("t_detail"));
                      daily_task_id.add(jsonobject.getString("t_id"));
                  }
              }
          }
          catch(Exception e)
          {}
          return null;
      }
      @Override
      protected void onPostExecute(Void args) {
          listadapter = new ListViewAdapterPendingdailytask(getActivity(), daily_task_name,daily_task_time,daily_task_detail,daily_task_id);
          listdaily.setAdapter(listadapter);
  
          Utility.setListViewHeightBasedOnChildren(listdaily);
      }
  }
  public static class Utility {
      public static void setListViewHeightBasedOnChildren(ListView listView) {
          ListAdapter listAdapter = listView.getAdapter();
          if (listAdapter == null) {
              // pre-condition
              return;
          }
  
          int totalHeight = 0;
          for (int i = 0; i &lt; listAdapter.getCount(); i++) {
              View listItem = listAdapter.getView(i, null, listView);
              listItem.measure(0, 0);
              totalHeight += listItem.getMeasuredHeight();
          }
  
          ViewGroup.LayoutParams params = listView.getLayoutParams();
          params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
          listView.setLayoutParams(params);
      }
  }
  </code></pre>
  
  <p>here the above code is for listview when the data is empty i want to hide Linear Layout. i don't know how to perform this task. i tried a lot but not getting the excet output.</p>
  
  <p>i Tried setEmptyView in this i can put a textview when the listview is empty. but i want to hide whole linear layout.</p>