title: Binary XML file line #11: Error inflating class fragment
body: <p>I am getting two Errors in my Code.</p>
  
  <p>Caused by: java.lang.IllegalStateException: Fragment com.example.dfoley.write_to_file.topFragment did not create a view.</p>
  
  <p>Caused by: android.view.InflateException: Binary XML file line #11: Error inflating class fragment both pointing to Line MainActivity.java:21 which is the following  setContentView(R.layout.activity_main);</p>
  
  <p>bottomFragment</p>
  
  <pre><code>package com.example.dfoley.write_to_file;
  import android.app.ListFragment;
  import android.os.Bundle;
  import android.widget.ArrayAdapter;
  
  import java.util.ArrayList;
  
  public class bottomFragment extends ListFragment {
      private ArrayAdapter&lt;StateUser&gt; adapter;
  
      @Override
      public void onActivityCreated(Bundle saveInstanceState){
          ArrayList&lt;StateUser&gt; flight = MainContoller.getInstance().getFlights();
          this.adapter = new ArrayAdapter&lt;StateUser&gt;(getActivity(), android.R.layout.simple_list_item_1, flight);
          setListAdapter(this.adapter);
          super.onActivityCreated(saveInstanceState);
      }
      public void refreshList(){
          this.adapter.notifyDataSetChanged();
      }
  }
  </code></pre>
  
  <p>Top Fragment</p>
  
  <pre><code>package com.example.dfoley.write_to_file;
  
  import android.app.Activity;
  import android.app.Fragment;
  import android.content.Context;
  import android.os.Bundle;
  import.android.util.Log;
  import android.view.View;
  import.android.widget.Button;
  import android.widget.EditText;
  
  import java.io.IOException; 
  import java.io.OutputStreamWriter;
  
  
  
  public class topFragment extends Fragment{
      private FlightSearcher searcher;
      EditText text1;
  
      public interface FlightSearcher {
          public void refreshFlightList();
      }
  
      @Override
      public void onAttach(Activity activity) {
          searcher = (FlightSearcher) activity;
          super.onAttach(activity);
      }
  
      @Override
      public void onActivityCreated(Bundle savedInstanceState){
          setupListeners();
          super.onActivityCreated(savedInstanceState);
      }
  
      public void setupListeners() {
          Button addUser = (Button)getActivity().findViewById(R.id.button);
          addUser.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  writeToFile();
                  searcher.refreshFlightList();
              }
          });
      }
  
      private void writeToFile() {
          text1=(EditText)getActivity().findViewById(R.id.editText);
          String AddUsers = text1.getText().toString();
          try {
              OutputStreamWriter outputStreamWriter = new OutputStreamWriter(getActivity().openFileOutput("UserList", Context.MODE_PRIVATE));
              outputStreamWriter.write(AddUsers);
              outputStreamWriter.close();
          }
          catch (IOException e) {
              Log.e("Exception", "File write failed: " + e.toString());
          }
      }
  }
  </code></pre>
  
  <p>Main Activity</p>
  
  <pre><code>package com.example.dfoley.write_to_file;
  
  import android.app.FragmentManager;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.view.Menu;
  import android.view.MenuItem;
  
  public class MainActivity extends FragmentActivity implements topFragment.FlightSearcher{
  
      public void refreshFlightList() {
          FragmentManager mgr = getFragmentManager();
          bottomFragment bottomFragmentRef =(bottomFragment) mgr.findFragmentById(R.id.bottom_fragment);
          bottomFragmentRef.refreshList();
      }
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
          return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>activiy_main.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:paddingBottom="@dimen/activity_vertical_margin"
  tools:context=".MainActivity"&gt;
  
  &lt;fragment
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:name="com.example.dfoley.write_to_file.topFragment"
      android:id="@+id/top_fragment"
      android:layout_weight="1"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      tools:layout="@layout/topfragment" /&gt;
  
  &lt;fragment
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:name="com.example.dfoley.write_to_file.bottomFragment"
      android:id="@+id/bottom_fragment"
      android:layout_weight="1"
      android:layout_below="@+id/top_fragment"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      tools:layout="@layout/bottomfragment" /&gt;
  </code></pre>
  
  <p></p>