小编cva*_*mar的帖子

onItemClickListener未在自定义ArrayAdapter上触发

我有一个Activity从Web服务检索数据.这个数据ListView通过一个ArrayAdapter 呈现在一个ArrayAdapter中,里面RelativeLayout有三个TextViews内部,没什么花哨的,它工作得很好.

现在我想要实现一个Activity应该在用户单击ListView中的项目时调用的详细信息,听起来很简单,但我不能在我的生活中使用onItemClickListener来处理我的ArrayAdapter.

这是我的主要内容Activity:

public class Schema extends Activity {

    private ArrayList<Lesson> lessons = new ArrayList<Lesson>();
    private static final String TAG = "Schema";
    ListView lstLessons;
    Integer lessonId;

    // called when the activity is first created.
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        // can we use the custom titlebar?
        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);

        // set the view
        setContentView(R.layout.main);

        // set the title
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar);

        // listview called lstLessons
        lstLessons = (ListView)findViewById(R.id.lstLessons); …
Run Code Online (Sandbox Code Playgroud)

android listview android-arrayadapter

21
推荐指数
4
解决办法
2万
查看次数

标签 统计

android ×1

android-arrayadapter ×1

listview ×1