以编程方式将运行时内容语言从Chines更改为英语

时间:2017-12-06 05:06:07

标签: java android geolocation locale data-conversion

在我的Android应用中,我使用提供商获取当前位置,它工作正常,但在设备默认语言不是英语时出现问题。

  

例如

设备默认语言为英语,然后是我当前的位置,如

No.764,平台,bbb街,c nagar,xyz,pincode-000000

同时设备默认语言不是英语。现在chines然后我当前的位置像

将文本翻译成中文。使用我们的免费文本翻译器来翻译中文和英文。

所以,我需要以编程方式将此内容更改为英文,获取当前日期时间也是同样的问题...请任何人帮我解决问题。

if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                            locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, (LocationListener) this);
                            location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
                            String AddressString = "0.0,0.0~Not able to get your current location from this user used device.";
                            if (location == null) {
                                location = getLastKnownLocation();
                            }
                            if (location != null) {
                                Address address = Utils.getAddress(InspectionReportActivity.this, location.getLatitude(), location.getLongitude());
                                String tempAddress = "";
                                if (address != null) {
                                    tempAddress = address.getAddressLine(0);
                                }
                                AddressString = String.valueOf(location.getLatitude()) + "," + String.valueOf(location.getLongitude()) + "~" + tempAddress;
                            }
}

AddressString是中文语言内容,而设备语言是中文。

提前致谢...

0 个答案:

没有答案