Make list View click with option


Last Updated:

  1. Duny

    Duny New Member This Topic's Starter

    Joined:
    Jun 6, 2010
    Messages:
    2
    Likes Received:
    0
    I am fairly new to Java, I have created a listview that shows some topics, now I want a user to be able to click one of the topics and take them to a new intent. Here is what I have so far. I have played around and can not make the list view click.

    Code (Text):
    1.  
    2. package com.example.app;
    3.  
    4.  
    5. import android.os.Bundle;
    6. import android.widget.ArrayAdapter;
    7. import android.widget.ListView;
    8.  
    9. public class Know extends iCorps {
    10.     private String[] Topics;
    11.  
    12.     @Override
    13.     public void onCreate(Bundle savedInstanceState) {
    14.         super.onCreate(savedInstanceState);
    15.         setContentView(R.layout.know);
    16.         Topics = getResources().getStringArray(R.array.topics);
    17.         //Arrays.sort(Countries);
    18.        
    19.         ListView list = (ListView)findViewById(R.id.list);
    20.         ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.listitem, Topics);
    21.         list.setAdapter(adapter);
    22. }
    23.    
    24.    
    25. }
    26.  
     

    Advertisement
  2. cp1

    cp1 Well-Known Member

    Joined:
    Apr 30, 2010
    Messages:
    375
    Likes Received:
    35
    Go through the notepad tutorial -- it does this.
     
    Duny likes this.

Share This Page

Loading...