title: How to open new activity when ImageView is click in the fragment
body: <p>Hi Im a newbie in android, can some help me implement a click on my ImageView to open new activity. I tried several codes but the app crashes on launch. Here is my code on fragments</p>
  
  <p>Fragment1.xml</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginLeft="8dp"
      android:layout_marginRight="8dp"
      android:fontFamily="sans-serif-light"
      android:paddingBottom="15dp"
      android:paddingTop="8dp" &gt;
  
      &lt;ImageView
          android:id="@+id/selectone"
          android:layout_width="fill_parent"
          android:layout_height="150dp"
          android:background="@drawable/fashion"
          android:clickable="true"
          android:focusable="true"
          android:onClick="onClick"
          android:scaleType="centerCrop" /&gt;
  
      &lt;ImageView
          android:id="@+id/selecttwo"
          android:layout_width="fill_parent"
          android:layout_height="150dp"
          android:layout_below="@+id/selectone"
          android:layout_marginTop="8dp"
          android:background="@drawable/lingerie"
          android:scaleType="centerCrop" /&gt;
  
      &lt;TextView
          android:id="@+id/titlelabel1"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/selectone"
          android:background="#80000000"
          android:fontFamily="sans-serif-light"
          android:padding="10dp"
          android:text="Fashion"
          android:textColor="#fefefe"
          android:textSize="28sp"
          android:textStyle="italic" /&gt;
  
      &lt;TextView
          android:id="@+id/titlelabel2"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_alignBottom="@+id/selecttwo"
          android:background="#80000000"
          android:fontFamily="sans-serif-light"
          android:padding="10dp"
          android:text="Lingerie"
          android:textColor="#fefefe"
          android:textSize="28sp"
          android:textStyle="italic" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Fragment1.java</p>
  
  <pre><code>package com.androidbegin.sidemenututorial;
  
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.LayoutInflater;
  import android.view.View.OnClickListener;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ImageView;
  import com.actionbarsherlock.app.SherlockFragment;
  
  public class Fragment1 extends SherlockFragment {
  
  ImageView fashionImg;
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.fragment1, container, false);
      return rootView;
  
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      //get the button view
      fashionImg = (ImageView) getView().findViewById(R.id.selectone);
      //set a onclick listener for when the button gets clicked
      fashionImg.setOnClickListener(new OnClickListener() {
          //Start new list activity
          public void onClick(View v) {
              Intent mainIntent = new Intent(getActivity(), CarouselActivity.class);
              startActivity(mainIntent);
          }
      });
  }
  </code></pre>
  
  <p>}</p>