title: android list view onclick to next activity
body: <p>I want to enter into next activity when I click on item on list view, Below is my code (When I click on sub1 I need to goto <code>sub1.class</code>) please help me</p>
  
  <pre><code>package com.example.fragments;
  
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import com.example.vikram.om.R;
  
      public class fragment2 extends Fragment{
          ListView listView;
         ArrayAdapter&lt;String&gt; adapter;
         String[] sem_II = {"sub1","sub2","sub3"};
         @Nullable
         @Override
         public View onCreateView(LayoutInflater inflater, ViewGroup container,
                               Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          View v = inflater.inflate(R.layout.fragment2_layout, container, false);
  
          listView = (ListView) v.findViewById(R.id.list_View);
          adapter = new ArrayAdapter&lt;String&gt;(getActivity(), android.R.layout.simple_list_item_1, sem_II);
          listView.setAdapter(adapter);
          return v;
      }
  }
  </code></pre>