title: Fragment over listview activity
body: <p>I am pretty new to android development, so please don't flame me for stupid questions/mistakes!</p>
  
  <p>I have a listview inside my activity, but i want to open up a fragment when a frame in the listview is clicked on. I have the onclick working, but it is not launching the new activity. </p>
  
  <p>I'll include my code below.</p>
  
  <p>This is the oncreate</p>
  
  <pre><code>protected void onCreate (Bundle savedInstanceState)
  {
      //Fragment fragment_blank2=new SomeFragment();
      e = myBadData.getData();
      super.onCreate(savedInstanceState);
      setContentView(R.layout.event_list);
      events=(ListView) findViewById(R.id.dayList);
      ArrayAdapter&lt;String&gt; adapter=new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,e);
      events.setAdapter(adapter);
      events.setOnItemClickListener(this);
  }
  </code></pre>
  
  <p>this is the onclick</p>
  
  <pre><code>public void onItemClick(AdapterView&lt;?&gt; adapterView, View view, final int i, long l)
  {
      myBadData.setId(i);
      Fragment fr = new event_description();
  
      FragmentManager fm = getFragmentManager();
      FragmentTransaction fragmentTransaction = fm.beginTransaction();
  
      fragmentTransaction.add(R.id.eventdescription, fr);
  }
  </code></pre>
  
  <p>this is the XML of the fragment </p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id = "@+id/eventdescription"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  tools:context="layout.BlankFragment"&gt;
  
  &lt;!-- TODO: Update blank fragment layout --&gt;
  
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="137dp"
          android:text="@string/event_name"
          android:textSize="26sp"
          android:layout_gravity="top"
          android:gravity="top|center"
          android:paddingTop="10dp"
          android:id="@+id/textView"
          android:background="@android:color/holo_orange_light"
          android:textColor="@android:color/black"
          android:layout_weight="1.08" /&gt;
      &lt;TextView
          android:text="@string/date"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/date"
          android:layout_marginTop="@dimen/activity_top_margin"
          android:layout_marginLeft="@dimen/activity_side_margin"
          android:textSize="18sp"
          android:drawableTint="@android:color/background_dark" /&gt;
      &lt;TextView
          android:text="@string/time"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/time"
          android:layout_marginTop="70dp"
          android:layout_marginLeft="@dimen/activity_side_margin"
          android:textSize="18sp" /&gt;
      &lt;TextView
          android:text="@string/cost"
          android:layout_gravity="right"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/cost"
          android:layout_marginTop="@dimen/activity_top_margin"
          android:layout_marginRight="70dp"
          android:textSize="18sp"/&gt;
      &lt;TextView
          android:text="@string/address"
          android:layout_gravity="right"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/address"
          android:layout_marginTop="70dp"
          android:layout_marginRight="60dp"
          android:textSize="18sp" /&gt;
  
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_marginTop="135dp"
          android:layout_marginLeft="10dp"&gt;
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:weightSum="1"&gt;
  
              &lt;TextView
                  android:id="@+id/tv_long"
                  android:paddingTop="10dp"
                  android:layout_width="wrap_content"
                  android:layout_height="match_parent"
                  android:text="@string/sample_text"
                  android:textSize="18sp"
                  android:layout_weight="1.08"&gt;
              &lt;/TextView&gt;
          &lt;/LinearLayout&gt;
      &lt;/ScrollView&gt;
  
      &lt;Button
          android:text="@string/add_to_calendar"
          android:layout_width="wrap_content"
          android:layout_height="40dp"
          android:id="@+id/button2"
          android:layout_gravity="center_horizontal"
          android:layout_marginTop="95dp"/&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>here is the class of the fragment</p>
  
  <pre><code>public class event_description extends Fragment
  {
      @Nullable
      //@Override
      public View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
      {
          View view = inflater.inflate (R.layout.event_description, container, false);
          Bundle args = getArguments();
          String arg = args.getString(eventList.KEY_NAME);
          //return super.(R.layout.event_description, container, false);
          return view;
      }
  
      public View getView() {
        return getView();
      }
  }
  </code></pre>