title: Android app working on emulator but not on a real device
body: <p>Just wrote this simple app for testing, a button that display the output with a <code>spellcheckersession</code>.</p>
  
  <p>It works fine on Emulator but don't work when i try to run the app on a real device (Note2 running android4.4.2).</p>
  
  <p>Can someone help me understand why?</p>
  
  <p>MainActivity.java:</p>
  
  <pre><code>package com.example.kevin.spellchecks;
  
  import android.content.Context;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.view.textservice.SentenceSuggestionsInfo;
  import android.view.textservice.SpellCheckerSession;
  import android.view.textservice.SuggestionsInfo;
  import android.view.textservice.TextInfo;
  import android.view.textservice.TextServicesManager;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.Collections;
  import java.util.List;
  
  public class MainActivity extends AppCompatActivity implements SpellCheckerSession.SpellCheckerSessionListener{
      TextView tv1, tv2, tv3;
      Button b1;
      EditText et1;
      private SpellCheckerSession mScs;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          b1 = (Button) findViewById(R.id.btn1);
          tv1 = (TextView) findViewById(R.id.tv1);
          tv2 = (TextView) findViewById(R.id.tv2);
          tv3 = (TextView) findViewById(R.id.tv3);
          et1 = (EditText) findViewById(R.id.et1);
  
          final  String[][] T9 = {
                  /* 0 */ {"a", "b", "c"},
                  /* 1 */ {"d", "e", "f"},
                  /* 2 */ {"g", "h", "i"},
                  /* 3 */ {"j", "k", "l"},
                  /* 4 */ {"m", "n", "o"},
                  /* 5 */ {"p", "q", "r", "s"},
                  /* 6 */ {"t", "u", "v"},
                  /* 7 */ {"w", "x", "y", "z"}
          };
          final ArrayList&lt;String&gt; prevalue = new ArrayList&lt;String&gt;();
          final ArrayList&lt;String&gt; buff = new ArrayList&lt;String&gt;();
          b1.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  prevalue.clear();
                  buff.clear();
                  tv1.setText("");
                  tv2.setText("");
                  tv3.setText("");
  
                  for(int et = 0; et&lt; et1.length(); et++) {
                      String subvalue = et1.getText().toString().substring(et, et + 1);
                      if(prevalue.size() !=0){
                          buff.add(prevalue.toString());
                          prevalue.clear();
                      }
                      for (int ii = 0; ii &lt; T9[Integer.parseInt(subvalue)].length; ii++) {
                          if(buff.size() != 0){
                              String[] buffarray = buff.toString().split("\\s*,\\s*");
                              for(int ba = 0; ba&lt;buffarray.length; ba++){
                                  prevalue.add(buffarray[ba].toString() + T9[Integer.parseInt(subvalue)][ii].toString());
                              }
                          }else{
                              prevalue.add(T9[Integer.parseInt(subvalue)][ii]);
                          }
                      }
                      buff.clear();
                  }
                  tv1.append("prevalue size: " + prevalue.size() + '\n');
                  for(int lp = 0; lp &lt; prevalue.size(); lp++){
                      String without1 = prevalue.get(lp).toString().replace("[", "");
                      String without2 = without1.replace("]", "");
                      tv1.append(without2 + '\n');
                      try{
                          mScs.getSuggestions(new TextInfo(without2.toString()), 1);
                      }catch (Exception e){
                      }
                  }
              }
          });
      }
      public void onResume() {
          super.onResume();
          final TextServicesManager tsm = (TextServicesManager)
                  getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE);
          mScs = tsm.newSpellCheckerSession(null, null, this, true);
      }
      public void onPause() {
          super.onPause();
          if (mScs != null) {
              mScs.close();
          }
      }
      public void onGetSuggestions(final SuggestionsInfo[] arg0) {
          final StringBuilder sb = new StringBuilder();
          for (int i = 0; i &lt; arg0.length; ++i) {
              final int len = arg0[i].getSuggestionsCount();
              sb.append('\n');
              for (int j = 0; j &lt; len; ++j) {
                  sb.append(arg0[i].getSuggestionAt(j));
              }
          }
  
          runOnUiThread(new Runnable() {
              public void run() {
                  tv2.setText(tv2.getText().toString() + sb.toString() + "");
              }
          });
      }
      @Override
      public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] arg0) {
          // TODO Auto-generated method stub
      }
  }
  </code></pre>
  
  <p>activity_main.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/activity_main"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.example.kevin.spellchecks.MainActivity"&gt;
  
      &lt;Button
          android:text="Button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:id="@+id/btn1" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:id="@+id/tv3" /&gt;
  
      &lt;EditText
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:inputType="number"
          android:ems="10"
          android:layout_alignTop="@+id/btn1"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:id="@+id/et1" /&gt;
  
      &lt;TextView
          android:text="Original"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/tv1"
          android:layout_below="@+id/tv3"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true" /&gt;
  
      &lt;TextView
          android:text="SpellCheck"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/tv2"
          android:layout_alignBaseline="@+id/tv1"
          android:layout_alignBottom="@+id/tv1"
          android:layout_centerHorizontal="true" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.kevin.spellchecks"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>build.gradle</p>
  
  <pre><code>apply plugin: 'com.android.application'
  
  android {
      compileSdkVersion 25
      buildToolsVersion "24.0.3"
      defaultConfig {
          applicationId "com.example.kevin.spellchecks"
          minSdkVersion 16
          targetSdkVersion 25
          versionCode 1
          versionName "1.0"
          testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
          release {
              minifyEnabled false
              proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
          }
      }
  }
  
  dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
          exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.android.support:appcompat-v7:25.1.1'
      testCompile 'junit:junit:4.12'
  </code></pre>