Hello @kartik,
The warning appeared when the soft keyboard was activated in one of my EditTexts and the activity lose focus.
What I did was to hide the keyboard in onPause();
@Override
protected void onPause() {
    // hide the keyboard in order to avoid getTextBeforeCursor on inactive InputConnection
    InputMethodManager inputMethodManager = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.hideSoftInputFromWindow(myEditText.getWindowToken(), 0);
    super.onPause();
}
Hope this work!