Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created June 14, 2018 08:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaurel/43df31f35707c89dd526a8edd34905a3 to your computer and use it in GitHub Desktop.
Save ssaurel/43df31f35707c89dd526a8edd34905a3 to your computer and use it in GitHub Desktop.
MainActivity for the In-App Keyboard tutorial on the SSaurel's Channel
package com.ssaurel.inappkeyboard;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.InputType;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
EditText editText = (EditText) findViewById(R.id.editText);
MyKeyboard keyboard = (MyKeyboard) findViewById(R.id.keyboard);
editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
editText.setTextIsSelectable(true);
InputConnection ic = editText.onCreateInputConnection(new EditorInfo());
keyboard.setInputConnection(ic);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment