1. Check out our app, Forums for Android! Download and leave feedback here!

Make list View click with option

Discussion in 'Application Development' started by Duny, Jun 8, 2010.

  1. Duny

    Duny New Member
    Thread Starter
    5

    Jun 6, 2010
    2
    0
    5
    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
    53

    Apr 30, 2010
    375
    35
    53
    Go through the notepad tutorial -- it does this.
     
    Duny likes this.

Share This Page

Loading...