Android InputMethodService - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android InputMethodService class.

This code example shows how to use the following methods: getWindow
 
    /** 
     * Switches to Voice IME. 
     */ 
    public void startVoiceRecognition(String language) {
        InputMethodManager inputMethodManager = getInputMethodManager(mInputMethodService);
 
        InputMethodInfo inputMethodInfo = getVoiceImeInputMethodInfo(inputMethodManager);
 
        if (inputMethodInfo == null) {
            return; 
        } 
 
        inputMethodManager.setInputMethodAndSubtype(mInputMethodService.getWindow().getWindow()
                .getAttributes().token,
                inputMethodInfo.getId(),
                getVoiceImeSubtype(inputMethodManager, inputMethodInfo));
    } 
 
    private static InputMethodManager getInputMethodManager(InputMethodService inputMethodService) {
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getCurrentInputConnection
		return inputMethodService.getCurrentInputEditorInfo();
	} 
 
	@Nonnull 
	private InputConnection getCurrentInputConnection() {
		InputConnection result = this.inputMethodService.getCurrentInputConnection();
		if (result == null) {
			result = NoInputConnection.getInstance();
		} 
		return result;
	} 
 
	@Override 
	public CharSequence getTypedText() {
		return typedText;
	} 
 
	@Override 
	public void clearTypedText() { 
		this.typedText.setLength(0);

5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getWindow
        switchToTargetIME(imiId, mShortcutSubtype, context);
    } 
 
    private void switchToTargetIME(final String imiId, final InputMethodSubtype subtype,
            final InputMethodService context) {
        final IBinder token = context.getWindow().getWindow().getAttributes().token;
        if (token == null) {
            return; 
        } 
        final InputMethodManager imm = mRichImm.getInputMethodManager();
        new AsyncTask<Void, Void, Void>() {
            @Override 
            protected Void doInBackground(Void... params) {
                imm.setInputMethodAndSubtype(token, imiId, subtype);
                return null; 
            } 
        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } 
 
    public boolean isShortcutImeEnabled() { 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: isInputViewShown
 
	public void pickSuggestionManually(int index) {
	} 
 
	protected void handleCharacter(int primaryCode, int[] keyCodes) {
		if (inputMethodService.isInputViewShown()) {
			if (state.isShifted()) {
				primaryCode = Character.toUpperCase(primaryCode);
			} 
		} 
 
		if (isAlphabet(primaryCode) && state.isPrediction()) {
			keyboardInput.append((char)primaryCode);
			updateShiftKeyState(keyboardInput.getCurrentInputEditorInfo());
			updateCandidates(); 
		} else { 
			keyboardInput.commitText(String.valueOf((char) primaryCode), 1);
		} 
	} 
 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getWindow
    /** 
     * Switches to Voice IME. 
     */ 
    @Override 
    public void startVoiceRecognition(String language) {
        InputMethodManager inputMethodManager = getInputMethodManager(mInputMethodService);
 
        InputMethodInfo inputMethodInfo = getVoiceImeInputMethodInfo(inputMethodManager);
 
        if (inputMethodInfo == null) {
            return; 
        } 
 
        inputMethodManager.setInputMethodAndSubtype(mInputMethodService.getWindow().getWindow()
                .getAttributes().token,
                inputMethodInfo.getId(),
                getVoiceImeSubtype(inputMethodManager, inputMethodInfo));
    } 
 
    private static InputMethodManager getInputMethodManager(InputMethodService inputMethodService) {
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android InputMethodService Questions & Answers:

See Code Examples for Android InputMethodService Methods: