Android: id list view

前端 未结 3 2061
闹比i
闹比i 2021-02-09 02:37

I have a list view declared in my xml:




        
3条回答
  •  生来不讨喜
    2021-02-09 03:10

    Your ListView object id should be specified either as android:id="@android:id/list"

    ListView lv = (ListView) findViewById(android.R.id.list);
    

    or it should have some other id like android:id="@+id/sampleList"

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

    Check this : ListActivity

    and list

    Hope this would help.

提交回复
热议问题