未验证 提交 4434a39c 编写于 作者: G Gary Qian 提交者: GitHub

Add api 21 check to LocalizationChannel.java (#7967)

上级 113b91fe
......@@ -4,6 +4,7 @@
package io.flutter.embedding.engine.systemchannels;
import android.os.Build;
import android.support.annotation.NonNull;
import java.util.ArrayList;
......@@ -35,7 +36,8 @@ public class LocalizationChannel {
for (Locale locale : locales) {
data.add(locale.getLanguage());
data.add(locale.getCountry());
data.add(locale.getScript());
// locale.getScript() was added in API 21.
data.add(Build.VERSION.SDK_INT >= 21 ? locale.getScript() : "");
data.add(locale.getVariant());
}
channel.invokeMethod("setLocale", data);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册