Java 文本视图中的Android阿拉伯文日期显示

Java 文本视图中的Android阿拉伯文日期显示,java,android,date,arabic,simpledateformat,Java,Android,Date,Arabic,Simpledateformat,我在文本视图中显示阿拉伯日期时遇到问题。我的代码如下 Locale locale = new Locale("ar", "KW"); SimpleDateFormat sdf = new SimpleDateFormat("E, dd-MMMM-yy"); Date currDate = new Date(); String formattedDate = sdf.format(currDate); txtDate.setText(formattedDate); 它显示以下输出阿拉伯日期问题

我在文本视图中显示阿拉伯日期时遇到问题。我的代码如下

Locale locale = new Locale("ar", "KW");
SimpleDateFormat sdf = new SimpleDateFormat("E, dd-MMMM-yy");
Date currDate = new Date();

String formattedDate = sdf.format(currDate);
txtDate.setText(formattedDate);
它显示以下输出阿拉伯日期问题图像:

但我需要的日期按照简单格式模式E,dd-MMMM-yy在阿拉伯语。
我该怎么办?

虚拟设备不支持阿拉伯语。在真正的设备上试用您的程序,它应该有Android 2.3或更高版本的操作系统。

虚拟设备不支持阿拉伯语。在真正的设备上试用你的程序,它应该有Android 2.3操作系统或更高版本。

检查谷歌代码中提出的问题

这个问题只出现在android 4.x中;我用阿拉伯语手机语言在安卓2.x上试过,没有问题

检查谷歌代码中提出的问题

这个问题只出现在android 4.x中;我试过android 2.x的阿拉伯语手机语言,没有问题

试试这个

public static String parseDateToddMMyyyy(String time) {
    String inputPattern = "yyyy-MM-dd HH:mm:ss";
    String outputPattern = "dd/MM/yyyy";

    SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern,
            Locale.ENGLISH);
    SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern,
            Locale.ENGLISH);

    Date date = null;
    String str = null;

    try {
        date = inputFormat.parse(time);
        str = outputFormat.format(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return str;
}
试试这个

public static String parseDateToddMMyyyy(String time) {
    String inputPattern = "yyyy-MM-dd HH:mm:ss";
    String outputPattern = "dd/MM/yyyy";

    SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern,
            Locale.ENGLISH);
    SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern,
            Locale.ENGLISH);

    Date date = null;
    String str = null;

    try {
        date = inputFormat.parse(time);
        str = outputFormat.format(date);
    } catch (ParseException e) {
        e.printStackTrace();
    }
    return str;
}

我在三星Galaxy S上进行了测试。我不知道为什么,但它显示的输出与emulator中的相同。@KevinAdesara是否有Android 2.3操作系统或更高版本?我在三星Galaxy S上进行了测试。我不知道为什么,但它显示的输出与emulator中的相同。@KevinAdesara是否有Android 2.3操作系统或更高版本?顺便说一句,157551575551575551575551515755日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日日阿拉伯文语法规则: