private InputMethodSubtype[] getSubtypes() {
   final PreferenceGroup group = getPreferenceScreen();
   final ArrayList<InputMethodSubtype> subtypes = new ArrayList<InputMethodSubtype>();
   final int count = group.getPreferenceCount();
   for (int i = 0; i < count; i++) {
     final Preference pref = group.getPreference(i);
     if (pref instanceof SubtypePreference) {
       final SubtypePreference subtypePref = (SubtypePreference) pref;
       // We should not save newly adding subtype to preference because it is incomplete.
       if (subtypePref.isIncomplete()) continue;
       subtypes.add(subtypePref.getSubtype());
     }
   }
   return subtypes.toArray(new InputMethodSubtype[subtypes.size()]);
 }