アタッチするカスタム アダプターを含むリスト ビューがあり、変更可能な情報を含むヘッダーが必要です。ヘッダーの xml レイアウトを作成しました。適用すると、すべてが正しく表示されます。しかし、ヘッダー ビューの要素を参照してその内容を設定しようとすると、Resource not found 例外が発生します。例外は、具体的には「name.setText(task.getName());」でスローされます。そこまで行くと、私が参照する3つの要素のそれぞれにスローされると思います。
これを行う正しい方法は何ですか?参照しているリソースは範囲外ですか? それらを正しく変更するにはどうすればよいですか?
リストを含む私のアクティビティの onCreate は以下のようになります:
super.onCreate(savedInstanceState);
setContentView(R.layout.taskview);
Object sTask = getIntent().getSerializableExtra("task");
TaskNode task = (TaskNode)sTask;
View header = getLayoutInflater().inflate(R.layout.header, null);
TextView name = (TextView) header.findViewById(R.id.hname);
TextView description = (TextView) header.findViewById(R.id.hdescription);
TextView completion = (TextView) header.findViewById(R.id.hcompletion);
name.setText(task.getName());
description.setText(task.getDescription());
completion.setText(task.completion());
taskList = (ListView) findViewById(R.id.taskList);
taskList.addHeaderView(header);
TaskViewListItem adapter = new TaskViewListItem(this, getApplicationContext(), task);
taskList.setAdapter(adapter);