title: AdapterView.OnItemClickListener to pass to a new activity
body: <p>I'm new to android programming and i need some help. I created a list, here is the code, and i want to pass to a new activity by clicking on an item in the list, can anybody suggest me how to do it step by step? Thanks!    </p>
  
  <pre><code> package com.example.andrian.testapp;
  
      import android.support.v7.app.ActionBarActivity;
      import android.os.Bundle;
      import android.view.Menu;
      import android.view.MenuItem;
      import android.app.Activity;
      import android.view.View;
      import android.widget.ArrayAdapter;
      import android.widget.ListView;
      import android.widget.AdapterView;
      import android.widget.Toast;
      import android.widget.AdapterView.OnItemClickListener;
  
      import com.example.andrian.testapp.R;
  
  
      public class MainActivity extends ActionBarActivity {
          ListView listView ;
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_main);
  
              listView = (ListView) findViewById(R.id.list);
  
              String[] values = new String[] {
                      "L0",
                      "L1",
                      "L2",
                      "L3",
                      "L4",
                      "L5",
                      "L6",
                      "L7"
              };
  
  
              ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,
                      android.R.layout.simple_list_item_1, android.R.id.text1,     values);
  
  
          listView.setAdapter(adapter);
  
          listView.setOnItemClickListener(new OnItemClickListener() {
  
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                      int position, long id) {
  
                  int itemPosition = position;
  
                  String itemValue = (String) listView.getItemAtPosition(position);
  
                  Toast.makeText(getApplicationContext(),
                          "Position: " + itemPosition + "  List Item: " + itemValue, Toast.LENGTH_LONG)
                          .show();
  
              }
  
          });
  
  
      }
  
      @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) {
          int id = item.getItemId();
  
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      }
  </code></pre>