开发者

Working on the formStuff

开发者 https://www.devze.com 2023-02-05 15:40 出处:网络
I was working on the formStuff samples and I am getting a error adding the EditText. This is the line I am getting a error one:

I was working on the formStuff samples and I am getting a error adding the EditText.

This is the line I am getting a error one:

edittext.setOnKeyListener(new OnKeyListener() {

This is the error:

Multiple markers at this line - OnKeyListener cannot be resolved to a type - The method setOnKeyListener(View.OnKeyListener) in the type View is not applicable for the arguments (new OnKeyListener(){})

http://developer.android.com/resources/tutorials/vi开发者_StackOverflow中文版ews/hello-formstuff.html


I think you should change your code to View.OnKeyListener from OnKeyListener...or to a particular "View" you want to listen on to the action....

from official Android Documentation following is a setOnKeyListener function signature:

void setOnKeyListener(View.OnKeyListener l) Register a callback to be invoked when a key is pressed in this view.


Fix the second error "OnKeyListener cannot be resolved to a type" and the first error will go away.

You need to import android.view.View.OnKeyListener;

0

精彩评论

暂无评论...
验证码 换一张
取 消