How do i use the OnItemClickListener to start a new intent based on which item is clicked?

后端 未结 3 2038
孤街浪徒
孤街浪徒 2021-01-21 02:44

I want to be able to start a new activity using the Intent class. I know how to start an activity by using these lines of code:

Intent myIntent = new Intent(v.ge         


        
3条回答
  •  庸人自扰
    2021-01-21 03:06

    You can use the position parameter in onItemClick to get the string you want out of the categoriesList array. So:

     String category = categoriesList.get(position);
    

    Probably have to make categoriesList a member variable, though.

提交回复
热议问题