Android: Determine active input method from code. InputMethodManager imm = (InputMethodManager) getSystemService(Context.
HowtousegetIdmethodinandroid.view.inputmethod.InputMethodInfoBestJavacodesnippetsusingandroid.view.inputmethod.InputMethodInfo.getId(Showingtop20resultsoutof315)AddtheCodotaplugintoyourIDEandgetsmartcompletionsprivatevoidmyMethod(){Charsetc=StringcharsetName;Charset.forName(charsetName)Charset.defaultCharset()ContentTypecontentType;contentType.getCharset()SmartcodesuggestionsbyTabnine}InputMethodManagerimm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
ListmInputMethodProperties=imm.getEnabledInputMethodList();
finalintN=mInputMethodProperties.size();
for(inti=0;iinputMethodInfos=inputMethodManager.getInputMethodList();
for(InputMethodInfoinputMethodInfo:inputMethodInfos){
if(inputMethodInfo.getId().contains("pinyin")){
pinyinId=inputMethodInfo.getId();
}
}
for(InputMethodInfoi:list){
if(i.getId().equals(Settings.Secure.getString(getContentResolver(),Settings.Secure.DEFAULT_INPUT_METHOD))){
...
}
}
publicInputMethodInfogetCurrentImeInfo(){
InputMethodManagerimm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
ListmInputMethodProperties=imm.getEnabledInputMethodList();
finalintn=mInputMethodProperties.size();
for(inti=0;iinputMethodInfos=imm.getEnabledInputMethodList();
finalintN=inputMethodInfos.size();
for(inti=0;imInputMethodProperties=imm.getEnabledInputMethodList();
//booleanisVoiceSearchServiceEnabled=false;
for(inti=0;ilst=imeManager.getEnabledInputMethodList();
for(InputMethodInfoinfo:lst){
System.out.println(info.getId()+""+info.loadLabel(getPackageManager()).toString());
}
publicvoidswitchToShortcutIME(finalInputMethodServicecontext){
if(mShortcutInputMethodInfo==null){
return;
}
finalStringimiId=mShortcutInputMethodInfo.getId();
switchToTargetIME(imiId,mShortcutSubtype,context);
}
publicStringgetInputMethodIdOfThisIme(){
returngetInputMethodInfoOfThisIme().getId();
}
publicStringgetInputMethodIdOfThisIme(){
returngetInputMethodInfoOfThisIme().getId();
}
publicstaticbooleanisLIMEEnabled(Contextcontext){
InputMethodManagerimm=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
ListmInputMethodProperties=imm.getEnabledInputMethodList();
StringlimeID=getLIMEID(context);
booleanisLIMEActive=false;
for(inti=0;imInputMethodProperties=imm.getEnabledInputMethodList();
finalintN=mInputMethodProperties.size();
for(inti=0;ienabledInputMethodList=inputMethodManager.getEnabledInputMethodList();
for(InputMethodInfoinputMethodInfo:enabledInputMethodList){
if(inputMethodInfo.getId().equals(id)){
ListenabledInputMethodSubtypeList=inputMethodManager.getEnabledInputMethodSubtypeList(inputMethodInfo,true);
for(InputMethodSubtypesubtype:enabledInputMethodSubtypeList){
if(subtype.getLocale().equals(locale)){
Settings.Secure.putInt(context.getContentResolver(),
Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE,subtype.hashCode());
}
}
}
}
@Override
publicvoidonCheckedChanged(RadioGroupgroup,intcheckedId){
intchildCount=group.getChildCount();
for(intx=0;xmInputMethodProperties=imm
.getEnabledInputMethodList();
finalintN=mInputMethodProperties.size();
for(inti=0;ienabledImis=mImmService.getEnabledInputMethodList();
finalintcurrentIndex=getImiIndexInList(getInputMethodInfoOfThisIme(),enabledImis);
if(currentIndex==INDEX_NOT_FOUND){
Log.w(TAG,"Can'tfindcurrentIMEinenabledIMEs:IMEpackage="
+getInputMethodInfoOfThisIme().getPackageName());
returnfalse;
}
finalInputMethodInfonextImi=getNextNonAuxiliaryIme(currentIndex,enabledImis);
finalListenabledSubtypes=getEnabledInputMethodSubtypeList(nextImi,
true/*allowsImplicitlySelectedSubtypes*/);
if(enabledSubtypes.isEmpty()){
//ThenextIMEhasnosubtype.
mImmService.setInputMethod(token,nextImi.getId());
returntrue;
}
finalInputMethodSubtypefirstSubtype=enabledSubtypes.get(0);
mImmService.setInputMethodAndSubtype(token,nextImi.getId(),firstSubtype);
returntrue;
}
privatebooleanswitchToNextInputMethodAndSubtype(finalIBindertoken){
finalInputMethodManagerimm=mImmWrapper.mImm;
finalListenabledImis=imm.getEnabledInputMethodList();
finalintcurrentIndex=getImiIndexInList(getInputMethodInfoOfThisIme(),enabledImis);
if(currentIndex==INDEX_NOT_FOUND){
Log.w(TAG,"Can'tfindcurrentIMEinenabledIMEs:IMEpackage="
+getInputMethodInfoOfThisIme().getPackageName());
returnfalse;
}
finalInputMethodInfonextImi=getNextNonAuxiliaryIme(currentIndex,enabledImis);
finalListenabledSubtypes=getEnabledInputMethodSubtypeList(nextImi,
true/*allowsImplicitlySelectedSubtypes*/);
if(enabledSubtypes.isEmpty()){
//ThenextIMEhasnosubtype.
imm.setInputMethod(token,nextImi.getId());
returntrue;
}
finalInputMethodSubtypefirstSubtype=enabledSubtypes.get(0);
imm.setInputMethodAndSubtype(token,nextImi.getId(),firstSubtype);
returntrue;
}
android.view.inputmethodInputMethodInfogetIdPopularmethodsofInputMethodInfogetPackageNamegetServiceInfogetSubtypeCountequalsgetServiceNamegetSubtypeAtloadLabelgetIsDefaultResourceIdgetSettingsActivityPopularinJavaStartanintentfromandroidscheduleAtFixedRate(ScheduledExecutorService)getSupportFragmentManager(FragmentActivity)getExternalFilesDir(Context)Proxy(java.net)Thisclassrepresentsproxyserversettings.AcreatedinstanceofProxystores
atypeandanaddresServlet(javax.servlet)Definesmethodsthatallservletsmustimplement.AservletisasmallJava
programthatrunswithinHttpServletRequest(javax.servlet.http)Extendsthejavax.servlet.ServletRequestinterfacetoproviderequest
informationforHTTPservlets.JComboBox(javax.swing)Scheduler(org.quartz)ThisisthemaininterfaceofaQuartzScheduler.ASchedulermaintainsaregistryoforg.quartz.JobOption(scala)Top17FreeSublimeTextPluginsProductsSearchforJavacodeSearchforJavaScriptcodeIDEPluginsIntelliJIDEAWebStormVisualStudioAndroidStudioEclipseVisualStudioCodePyCharmSublimeTextPhpStormVimAtomGoLandRubyMineEmacsJupyterNotebookJupyterLabRiderDataGripAppCodeCompanyAboutUsContactUsCareersResourcesFAQBlogTabnineAcademyStudentsTermsofusePrivacypolicyJavaCodeIndexJavascriptCodeIndexGetTabnineforyourIDEnow