Bonsoir,

J'utilise Android SDK sous LinuxMint.
Mon problème est très simple : j'ai crée un service (un clavier virtuel qui fait de l'auto-correction). Comble du bonheur, le clavier compile sans erreurs ni warnings. Je lance l'émulateur (Nexus_5_API_23_x86) par le bouton "run" avec "app" dans le petit menu déroulant à gauche. Mais lorsque je vais dans les paramètres du smartphone et que je cherche tous les claviers disponibles, le mien n'apparaît pas.

Merci de votre aide !

Mon code suit (j'ai utilisé http://code.tutsplus.com/tutorials/c...oid--cms-22615) :

Voici mon manifeste :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.basile.smartsms2">
 
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
 
        <service android:name="Smart_Keyboard"
            android:label="@string/service_name"
            android:permission="BIND_INPUT_METHOD">
 
            <intent-filter>
                <action android:name="android.view.InputMethod"/>
                <meta-data android:name="android.view.im" android:resource="@xml/method"/>
            </intent-filter>
 
        </service>
 
    </application>
 
</manifest>
Mon activité principale :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
 
package com.basile.smartsms2;
 
import android.content.res.Configuration;
import android.inputmethodservice.InputMethodService;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.KeyboardView;
import android.inputmethodservice.KeyboardView.OnKeyboardActionListener;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.InputConnection;
import android.widget.TextView;
 
public class Smart_Keyboard extends InputMethodService implements OnKeyboardActionListener{
 
 
    public static int first_letter = 1;
    public static SMSMessage next_message;
    public static SMSMessage corrected_message;
 
    @Override
    public void onKey(int primaryCode, int[] keyCodes)
    {
 
        InputConnection the_input_connection = getCurrentInputConnection();
 
 
        if (1 == first_letter) {
            next_message = new SMSMessage();
            first_letter = 0;
        }
 
        switch (primaryCode) {
            case 0:
                corrected_message = next_message.correct_version1(getApplicationContext());
                next_message = new SMSMessage();
                the_input_connection.sendKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
                return;
            case 1:
                next_message.add_digit(1);
                return;
            case 2:
                next_message.add_digit(2);
                return;
            case 3:
                next_message.add_digit(3);
                return;
            case 4:
                next_message.add_digit(4);
                return;
            case 5:
                next_message.add_digit(5);
                return;
            case 6:
                next_message.add_digit(6);
                return;
            case 7:
                next_message.add_digit(7);
                return;
            case 8:
                next_message.add_digit(8);
                return;
            case 9:
                next_message.add_digit(9);
                return;
            case 10:
                return;
            case 11:
                next_message.remove_digit();
                return;
            case Keyboard.KEYCODE_DONE:
                break;
            default:
        }
    }
 
    @Override
    public void onPress(int primaryCode) {
    }
 
    @Override
    public void onRelease(int primaryCode) {
    }
 
    @Override
    public void onText(CharSequence text) {
    }
 
    @Override
    public void swipeDown() {
    }
 
    @Override
    public void swipeLeft() {
    }
 
    @Override
    public void swipeRight() {
    }
 
    @Override
    public void swipeUp() {
    }
 
 
 
    // Create the view to launch the keyboard
    @Override
    public View onCreateInputView()
    {
 
        // Has the mobile already a digit keyboard ?
        Configuration config = getResources().getConfiguration();
        if (Configuration.KEYBOARD_12KEY != config.keyboard)
        {
            KeyboardView my_keyboard_view = (KeyboardView) getLayoutInflater().inflate(R.layout.smart_sms_keyboard_view, null);
            Keyboard smart_sms_keyboard = new Keyboard(this, R.xml.digits_keyboard);
 
 
            my_keyboard_view.setOnKeyboardActionListener(this);
            my_keyboard_view.setKeyboard(smart_sms_keyboard);
 
            return my_keyboard_view;
        }
        else
        {
            return null;
        }
    }
}
et methods.xml

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
<?xml version="1.0" encoding="utf-8"?>
<input-method xmlns:android="http://schemas.android.com/apk/res/android">
    <subtype
        android:label="@string/subtype_en_US"
        android:imeSubtypeLocale="en_US"
        android:imeSubtypeMode="keyboard" />
</input-method>
J'ai mis les principaux fichiers, dites moi si vous en voulez plus