Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.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
Java 使用Android Geocoder getFromLocation获取俄语地址_Java_Android_Dictionary - Fatal编程技术网

Java 使用Android Geocoder getFromLocation获取俄语地址

Java 使用Android Geocoder getFromLocation获取俄语地址,java,android,dictionary,Java,Android,Dictionary,我正在使用地理编码器从lat和long获取地址。这是我的密码: Geocoder geocoder = new Geocoder(this, Locale.getDefault()); List<Address> addressList = geocoder.getFromLocation(lat, lng, 1); Geocoder-Geocoder=new-Geocoder(这个,Locale.getDefault()); 列表地址列表=地理编码器。getFromLocatio

我正在使用地理编码器从lat和long获取地址。这是我的密码:

Geocoder geocoder = new Geocoder(this, Locale.getDefault());
List<Address> addressList = geocoder.getFromLocation(lat, lng, 1);
Geocoder-Geocoder=new-Geocoder(这个,Locale.getDefault());
列表地址列表=地理编码器。getFromLocation(lat,lng,1);
它给了我正确的地址,但用英语。我需要俄语的地址。到目前为止,我尝试将locale设置为俄语,并将其传递给geocoder对象

Locale aLocale = new Locale.Builder().setLanguage("RU").setScript("Latn").setRegion("RS").build();
Geocoder geocoder = new Geocoder(this, aLocale);
List<Address> addressList = geocoder.getFromLocation(lat, lng, 1);
Locale aLocale=new Locale.Builder().setLanguage(“RU”).setScript(“Latn”).setRegion(“RS”).build();
Geocoder Geocoder=新的Geocoder(这是一个缩尺);
列表地址列表=地理编码器。getFromLocation(lat,lng,1);
但我还是得到了英语而不是俄语的地址。请建议我该怎么做

提前谢谢。

试试这段代码

        Locale aLocale;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            aLocale = new Locale.Builder().setLanguage("RU").setScript("Latn").setRegion("RS").build();
        } else {
            aLocale = new Locale("RU");
        }
        Geocoder geocoder = new Geocoder(this, aLocale);
        List<Address> addressList = geocoder.getFromLocation(lat, lng, 1);
Locale-aLocale;
if(Build.VERSION.SDK\u INT>=Build.VERSION\u code.LOLLIPOP){
aLocale=new Locale.Builder().setLanguage(“RU”).setScript(“Latn”).setRegion(“RS”).build();
}否则{
aLocale=新区域设置(“RU”);
}
Geocoder Geocoder=新的Geocoder(这是一个缩尺);
列表地址列表=地理编码器。getFromLocation(lat,lng,1);
现场模拟;
if(Build.VERSION.SDK\u INT>=Build.VERSION\u code.LOLLIPOP){
aLocale=new Locale.Builder().setLanguage(“RU”).setScript(“Cyrl”).setRegion(“RS”).build();
}否则{
aLocale=新区域设置(“RU”);
}
Geocoder Geocoder=新的Geocoder(这是一个缩尺);
列表地址列表=地理编码器。getFromLocation(lat,lng,1);

仍然使用拉丁语而不是俄语西里尔语
Locale aLocale;
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            aLocale = new Locale.Builder().setLanguage("RU").setScript("Cyrl").setRegion("RS").build();
        } else {
            aLocale = new Locale("RU");
        }
        Geocoder geocoder = new Geocoder(this, aLocale);
        List<Address> addressList = geocoder.getFromLocation(lat, lng, 1);