为什么Aarray初始化不允许在android studio中

时间:2017-07-20 17:37:44

标签: android

我尝试将字符串转换为我的语言来自雅虎天气服务,实际上我是android的新手。当我把

String days = {"الاحد", "الاثنين", "الثلااء", "الاربعاء", "الخميس", "الجمعة", "السبت"};

我得到平均错误和读取线。

package net.digitalphantom.app.weatherapp.data;

import android.widget.TextView;

import net.digitalphantom.app.weatherapp.R;
import net.digitalphantom.app.weatherapp.WeatherActivity;

import org.json.JSONException;
import org.json.JSONObject;

public class Condition implements JSONPopulator {
    private int code;
    private int temperature;
    private int highTemperature;
    private int lowTemperature;
    private String description;
String days = {"الاحد", "الاثنين", "الثلااء", "الاربعاء", "الخميس", "الجمعة", "السبت"};
    private String text;

    public int getCode() {
        return code;
    }

    public int getTemperature() {
        return temperature;
    }

    public int getHighTemperature() {
        return highTemperature;
    }

    public int getLowTemperature() {
        return lowTemperature;
    }

    public String getDescription() {
        return description;
    }

    public String getDay() {
        return days;
    }
    public String gettext() {return text;}

    @Override
    public void populate(JSONObject data) {
        code = data.optInt("code");
        temperature = data.optInt("temp");
        highTemperature = data.optInt("high");
        lowTemperature = data.optInt("low");
        description = data.optString("text");
        days = data.optString("day");
        text = data.optString("text");

    }

    @Override
    public  JSONObject toJSON() {
        JSONObject data = new JSONObject();

        try {
            data.put("code", code);
            data.put("temp", temperature);
            data.put("high", highTemperature);
            data.put("low", lowTemperature);
            data.put("text", description);
            data.put("day", days);
            data.put("text", text);

        } catch (JSONException e) {
            e.printStackTrace();
        }

        return data;

    }
}

我想使用字符串日有什么办法吗?我希望有一些代码的帮助:)

0 个答案:

没有答案