Hej,
Zrobiłem klawiaturę na Androida i chciałbym teraz, aby ta klawiatura była widoczna na innych telefonach przez bluetooth oraz na tym telefonie mogła realizować swoje funkcjonalności. Czy jest możliwe zrobienie czegoś takiego? Mógłbym prosić o jakieś podpowiedzi?
Tutaj kawałek kodu klawiatury:
public class MyInputMethodService extends InputMethodService implements KeyboardView.OnKeyboardActionListener {
private static final int pic_id = 123;
EditText editText;
@Override
public View onCreateInputView() {
// get the KeyboardView and add our Keyboard layout to it
KeyboardView keyboardView = (KeyboardView) getLayoutInflater().inflate(R.layout.keyboard_view, null);
Keyboard keyboard = new Keyboard(this, R.xml.number_pad);
Keyboard keyboard2 = new Keyboard(this, R.xml.number_pad2);
keyboardView.setKeyboard(keyboard);
keyboardView.setOnKeyboardActionListener(this);
return keyboardView;
}
@Override
public void onKey(int primaryCode, int[] keyCodes) {
InputConnection ic = getCurrentInputConnection();
if (ic == null) return;
switch (primaryCode) {
case Keyboard.KEYCODE_DELETE:
CharSequence selectedText = ic.getSelectedText(0);
if (TextUtils.isEmpty(selectedText)) {
// no selection, so delete previous character
ic.deleteSurroundingText(1, 0);
} else {
// delete the selection
ic.commitText("", 1);
}
break;
case 53:
Toast.makeText(getApplicationContext(), "Toast", Toast.LENGTH_SHORT).show();
break;