Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在android中检测用户输入的文本语言_Android_Android Edittext - Fatal编程技术网

如何在android中检测用户输入的文本语言

如何在android中检测用户输入的文本语言,android,android-edittext,Android,Android Edittext,我需要知道如何在android中检测用户在editText中输入的文本的语言 我搜索了所有可以用来解决这个问题的方法,特别是在这个链接中, 但这并不适用,因为应用程序在启动前就崩溃了 我还尝试了“locale”,但它不起作用,因为它指定了设备的语言,而不是在编辑文本中写入的文本 有什么解决办法吗?你能帮我吗?试试这个 InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE

我需要知道如何在android中检测用户在editText中输入的文本的语言

我搜索了所有可以用来解决这个问题的方法,特别是在这个链接中, 但这并不适用,因为应用程序在启动前就崩溃了

我还尝试了“locale”,但它不起作用,因为它指定了设备的语言,而不是在编辑文本中写入的文本

有什么解决办法吗?你能帮我吗?

试试这个

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);

    InputMethodSubtype ims = imm.getCurrentInputMethodSubtype();

    String locale = ims.getLocale();