setOnItemClickListener not getting called

前端 未结 3 951
盖世英雄少女心
盖世英雄少女心 2020-12-07 05:54

I have this in the onCreate method as follows:

    ListView lv = (ListView)findViewById(android.R.id.list);
   adapter = new ModuleAdapter(this);
   lv.setAd         


        
3条回答
  •  再見小時候
    2020-12-07 06:57

    ListView lv = (ListView)findViewById(android.R.id.list); - it's if you trying to get android System resources, but you want listview wich you describe on xml layout.

    Let's say it's look like:

    
    
    
        
        
    
    
    

    so you need change your code to

    ListView lv = (ListView)findViewById(R.id.listView1);

    Some explain: android.R - it's default resources of Android OS - llike buttons,images, listview items layouts and etc. R. - it' your project resoures full path likes [your package path].R for example: com.example.R

提交回复
热议问题