I'm attempting to implement a custom keyboard in my app and I need to use it during a login dialog prompt.
I've attempted to implement the example found here:
http://www.fampennings.nl/maarten/android/09keyboard/index.htm
However I'm getting an error in my code when I attempt to implement it on the line:
mCustomKeyboard= new CustomKeyboard(this, R.id.keyboardview, R.xml.hexkbd );
Stating that "The constructor CustomKeyboard(LoginDialog, int, int) is undefined LoginDialog.java"
I've tried changing the constructor from:
public CustomKeyboard(Activity host, int viewid, int layoutid) {
mHostActivity= host;
to
public CustomKeyboard(LoginDialog loginDialog, int viewid, int layoutid) {
mHostActivity= loginDialog;
but it causes a domino effect of other issues in the code so I'm thinking there is a better way of implementing this constructor.
LoginDialog.java
public class LoginDialog extends DialogFragment implements
ActionCompletedListener {
private View view;
private String whichActivity = "";
private TextView error;
CustomKeyboard mCustomKeyboard;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(
new ContextThemeWrapper(getActivity(), R.style.HoloDarkDialog));
LayoutInflater inflater = getActivity().getLayoutInflater();
view = inflater.inflate(R.layout.login, null);
mCustomKeyboard = new CustomKeyboard(this, R.id.keyboardview,
R.xml.hexkbd);
CustomKeyboard.java
public CustomKeyboard(Activity host, int viewid, int layoutid) {
mHostActivity= host;
mKeyboardView= (KeyboardView)mHostActivity.findViewById(viewid);
mKeyboardView.setKeyboard(new Keyboard(mHostActivity, layoutid));
mKeyboardView.setPreviewEnabled(false); // NOTE Do not show the preview balloons
mKeyboardView.setOnKeyboardActionListener(mOnKeyboardActionListener);
// Hide the standard keyboard initially
mHostActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
P.S.
Any suggestions are GREATLY appreciated... and additional information/source can/will be provided promptly by request.
Full source can be found here:
http://www.fampennings.nl/maarten/android/09keyboard/index.htm