तो मैं इस जावा कोड है:Kotlin साथ setOnEditorActionListener कैसे
editText.setOnEditorActionListener() { v, actionId, event ->
if(actionId == EditorInfo.IME_ACTION_DONE){
doSomething()
} else {
}
}
: मैं इस (जो मैं भी यकीन है कि यह सही तरीका है नहीं कर रहा हूँ) प्राप्त करने के लिए प्रबंधित किया है
editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
doSomething();
return true;
}
return false;
}
});
लेकिन मुझे एक त्रुटि मिली है Error:(26, 8) Type mismatch: inferred type is kotlin.Unit but kotlin.Boolean was expected
तो कोटलिन में ऐसे ईवेंट हैंडलर को कैसे लिखा जाता है?
हां, उसी परिणाम – Pier