Android 键盘自动出现,是否为此使用broadcastreceiver或InputMethodService?

Android 键盘自动出现,是否为此使用broadcastreceiver或InputMethodService?,android,keyboard,Android,Keyboard,我正在尝试制作一个演示项目,根据这个项目,每当用户在任何活动中单击edittext,我的应用程序的活动就开始了 因此,每当我们在任何应用程序的任何活动中单击edittext时,无论是fb、whatsapp、LINE等,键盘都会自动出现,我对此感到困惑 它是否使用broadcastreceiver或InputMethodService进行此操作 如果它使用的是InputMethodService,如果我没有错的话,这个InputMethodService就是一种服务,它有一个缺点,就是系统有时会自

我正在尝试制作一个演示项目,根据这个项目,每当用户在任何活动中单击edittext,我的应用程序的活动就开始了

因此,每当我们在任何应用程序的任何活动中单击edittext时,无论是fb、whatsapp、LINE等,键盘都会自动出现,我对此感到困惑 它是否使用broadcastreceiver或InputMethodService进行此操作 如果它使用的是InputMethodService,如果我没有错的话,这个InputMethodService就是一种服务,它有一个缺点,就是系统有时会自动关闭后台服务来释放内存。但每次我们点击edittext时,键盘都会出现。 那么,有谁能告诉我们,每当我们点击edittext时,键盘是如何出现的呢。
感谢

InputMethodService是一项检测何时显示android键盘的服务, 此服务是一个android系统服务

你可以试着提供服务并对其进行研究。您可以使用下面的代码,并在showsoftwinput()方法中实现您的意图


所以我想在键盘出现时启动我的应用程序,我的类扩展InputMethodService吗?不,我想在任何应用程序的edittext单击时启动我的应用程序,无论是fb、whatsapp还是Line。无论何时单击任何应用程序的编辑文本,我的应用程序都会launch@DevilAbhi我认为这是不可能的。每当键盘出现时,这项服务会被称为?,,我是否声明,,,以及如何在创建活动时启动这项服务?@nawaab-saab你能找到解决方案吗(无论是fb、whatsapp还是Line,只要点击任何应用程序的edittext,就启动。只要点击任何应用程序的edittext,我的应用程序就会启动)我需要做类似的事情。谢谢
     import android.inputmethodservice.InputMethodService;
     import android.os.IBinder;
     import android.os.ResultReceiver;
     import android.view.inputmethod.EditorInfo;
     import android.view.inputmethod.InputBinding;
     import android.view.inputmethod.InputConnection;
     import android.view.inputmethod.InputMethod;
     import android.view.inputmethod.InputMethodSession;
     import android.view.inputmethod.InputMethodSubtype;

 public class MyService extends InputMethodService implements InputMethod{

@Override
public void attachToken(IBinder token) {
    // TODO Auto-generated method stub

}

@Override
public void bindInput(InputBinding binding) {
    // TODO Auto-generated method stub

}

@Override
public void changeInputMethodSubtype(InputMethodSubtype subtype) {
    // TODO Auto-generated method stub

}

@Override
public void createSession(SessionCallback callback) {
    // TODO Auto-generated method stub

}

@Override
public void hideSoftInput(int flags, ResultReceiver resultReceiver) {
    // TODO Auto-generated method stub

}

@Override
public void restartInput(InputConnection inputConnection,
        EditorInfo attribute) {
    // TODO Auto-generated method stub

}

@Override
public void revokeSession(InputMethodSession session) {
    // TODO Auto-generated method stub

}

@Override
public void setSessionEnabled(InputMethodSession session, boolean enabled) {
    // TODO Auto-generated method stub

}

@Override
public void showSoftInput(int flags, ResultReceiver resultReceiver) {
    // TODO Auto-generated method stub
//  Run your APP here
    //Intent to your acticity
}

@Override
public void startInput(InputConnection inputConnection, EditorInfo info) {
    // TODO Auto-generated method stub

}

@Override
public void unbindInput() {
    // TODO Auto-generated method stub

}



   }