I'm beginning android development and was going through some guides in which I tumbled across this piece of code :
myEditText.setOnKeyListener (new OnKeyListener() {
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (event.getAction() == KeyEvent.ACTION_DOWN)
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER)
{
todoItems.add(0, myEditText.getText().toString());
aa.notifyDataSetChanged();
myEditText.setText(“”);
return true;
}
return false;
}
});
I would like to ask, what kind of parameter is the method "myEditText.setOnKeyListener" taking? It looks confusing to me because it contains new keyword, bunch of codes in curly braces, return...etc etc.... Anyone please explain.....
regards,