0
경고가 있습니다. 코드가 작동합니다. 문자열에 대해 여러 언어 폴더가 있습니다. res/values/strings.xml
& res/values-es/strings.xml
등. UI에서는 문제가 없지만 경고 제목, 버튼 제목 & 경고 메시지, 다른 언어로도 보내고 싶습니다. 기본 언어 (영어)로 계속 올라갑니다. 문자열 변수 & getResources().getString(R.string.name);
을 사용하면 응용 프로그램이 손상됩니다. 문서는 ... 다른 사람들이 비슷한 질문이 있거나 응답이없는 것을 보았습니다. 누구든지이 문제를 해결하는 방법을 알고 있습니까? 로케일 등을 지정 하시겠습니까?다국어 경고 문자열 리소스
public void showSettingsAlert(){
AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
//String title_settings = getResources().getString(R.string.Settings);
//String title_cancel = getResources().getString(R.string.Cancel);
//String GPS_settings = getResources().getString(R.string.GPS_Settings);
//String GPS_not_enabled = getResources().getString(R.string.GPS_not_enabled);
//String title_settings =getResources().getString(R.string.Settings);
// Setting Dialog Title
alertDialog.setTitle("GPS Settings");
//alertDialog.setTitle(GPS_settings);
// Setting Dialog Message
alertDialog.setMessage("GPS is not enabled. Do you want to go to settings menu?");
//alertDialog.setMessage(GPS_not_enabled);
// On pressing Settings button
alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
//alertDialog.setPositiveButton(settings, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int which) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
mContext.startActivity(intent);
}
});
// on pressing cancel button
alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
//alertDialog.setNegativeButton(cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
// Showing Alert Message
alertDialog.show();
}