I got stuck with an error while writing this part of code:
ListView lv = (ListView) this.findViewById(R.id.toDoListView);
lv.setAdapter(tdla);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent newIntent = new Intent(this, DisplayMessageActivity.class);//<--- Cannot resolve constructor
newIntent.putExtra(EXTRA_MESSAGE, "TETTE");
startActivity(newIntent);
}
});
I thought Intent constructor should be the same as declaring it in a simple function linked to a Button as:
public void sendMessage(View view){
Intent newIntent = new Intent(this, DisplayMessageActivity.class);//<--- OK
...sth...
startActivity(newIntent);
}
Also How to handle the click event in Listview in android? shows a similar example but I can't figure out what I'm missing.