title: Start Activities from onItemClick of ListView in fragments
body: <p>So I have two fragments linking to layout files which display ListViews. The ListViews are defined in the xml and have entries from a string array. I want to click on items in the ListView and open new activities. There are 8 items in one ListView and 9 in the other. In the onItemClick code, how do I create intents to start activities based on the item clicked? I will create 1 class per item as its own activity. How can I start the activities in the classes via intents inside the onItemClick methods of this code?</p>
  
  <pre><code>class CommunityFragment extends Fragment{
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
  
          View view = inflater.inflate(R.layout.community_fragment, container, false);
          ListView lv = (ListView) view.findViewById(R.id.communityListView);
          lv.setOnItemClickListener(new OnItemClickListener(){
              @Override
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3){
                  // TODO Auto-generated method stub
  
              }
          });
          return view;
      }
  }
  class ResourcesFragment extends Fragment{
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
  
          View view = inflater.inflate(R.layout.resources_fragment, container, false);
          ListView lv = (ListView) view.findViewById(R.id.resourcesListView);
  
          lv.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) {
                  // TODO Auto-generated method stub
  
              }
          });
          return view;
      }
  }
  </code></pre>