Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Android Lists and Adapters (2015) Acting on List Item Taps Tapping on a ListView Item

RecyclerView sendVote()

Hi Jonathan Grieve. I finally solved the ListView problem. Am stuck on this one. Went through documentation and video but still stuck.

import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.view.ListView;

public class GameListActivity extends ListActivity {

    public String[] mGames = {
        "Age of Empires",

    public void onCreate(Bundle savedInstanceState) {

        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, mGames);

    protected void onListItemClick(ListView l, View v, int position, long id) {
       super.onListItemClick(l, v, position, id);

      String games = mGames[position].sendVote();


    // This is a helper method to tally votes on a back-end system
    public void sendVote(String game) {
Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 90,956 Points

Unfortunately I don't know enough about Android Lists and Adapters to give a reliable answer here, but again, if you post the error message the code challenge is giving you maybe someone else can help?

Also I bet if you rewatch the proceeding video some inspiration will come to you :)

1 Answer

Inspiration AHOY! ;)