I'm trying to create an android keyboard, this code works fine so far
package keyboard.rob.com;
import...
public class xyz extends InputMethodService
implements KeyboardView.OnKeyboardActionListener {
private LinearLayout开发者_开发问答 mInputView;
@Override public View onCreateInputView() {
mInputView = (LinearLayout) getLayoutInflater().inflate(R.layout.main, null);
return mInputView;
}
...
but later on when I'm trying to make
LinearLayout LinLayBg = (LinearLayout)findViewById(R.id.LL_total);
to populate it with buttons, it show
"*The method findViewById(int) is undefined for the type zyz *"
Any ideas? Thanks!
i think you are trying to call the method findViewById(int id);
from a non instance of a View .
Try :
mInputView.findViewById(R.id.LL_total);
hope it helps
You should be able to do it this way:
View.findViewById(R.id.LL_total);
精彩评论