title: Set on item click listener for items in a listview and go to a new activity
body: <p>I have list view(data is retrieved from the database and put into the listview). What I want to do is make each item in the clickable and once clicked I want it to go to a new activity I have tried a <code>setOnItemClickListener</code> but it does not work</p>
  
  <pre><code>public class MomentsActivity extends AppCompatActivity {
  
  
     ListView listView;
      TextView description;
      TextView location;
      TextView name;
      //ImageView image; used later when we want to display the image
  
      private TextView mTextMessage;
  
      private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
              = new BottomNavigationView.OnNavigationItemSelectedListener() {
  
          @Override
          public boolean onNavigationItemSelected(@NonNull MenuItem item) {
              switch (item.getItemId()) {
                  case R.id.navigation_moments:
                      Intent intent = new Intent(MomentsActivity.this, MomentsActivity.class);
                      intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                      startActivity(intent);
                      break;
  
                  case R.id.navigation_addmoment:
                      Intent intent2 = new Intent(MomentsActivity.this, AddMomentActivity.class);
                      intent2.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                      startActivity(intent2);
                      break;
              }
              return false;
          }
      };
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          myDb = new DatabaseHelper(this);
          setContentView(R.layout.activity_moments);
          BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
          navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
          mList = this.findViewById(R.id.my_listview);
  
          listView = (ListView) findViewById(R.id.my_listview);
          mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                  Intent intent = new Intent(MomentsActivity.this,MainActivity.class);
                  intent.putExtra("textview_name", listView.getItemIdAtPosition(position));
                  startActivity(intent);
              }
          });
  
  
          manageListView();
  
  
  
  
  
  
          getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
          getSupportActionBar().setCustomView(R.layout.actionbar_layout);
      }
  
  
  
  
      DatabaseHelper myDb;
      EditText editTitle, editDescription, editLocation;
      Button btnAddData;
      Button btnViewAll;
      SimpleCursorAdapter mSCA; //Adapts/Handles the data for the listview
      ListView mList;
      Cursor mCsr;
  
  
      int[] item_layout_ids_for_list = new int[]{
              R.id.textview_name,
              R.id.textview_description,
              R.id.textview_location
      };
  
      String[] columns_to_list = new String[]{
              DatabaseHelper.COL_2,
              DatabaseHelper.COL_3,
              DatabaseHelper.COL_5
      };
  
      private void manageListView() {
          mCsr = myDb.getAllData();
          if (mSCA == null) {
              // Builds the Adapter for the List
              mSCA = new SimpleCursorAdapter(
                      this,
                      R.layout.mylistview_item, mCsr,
                      columns_to_list,
                      item_layout_ids_for_list,
                      0
              );
              mList.setAdapter(mSCA); // Ties the Adapter to the ListView
          } else {
              mSCA.swapCursor(mCsr); // Refresh the List
          }
      }
  
      @Override
      protected void onDestroy() {
          super.onDestroy();
          mCsr.close();
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          manageListView();
      }
  
  }
  </code></pre>