Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/57.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
Android 安卓系统中的祈祷时间(ا;و;ق;ا;ت;ش;ر;ع;ی;)_Android - Fatal编程技术网

Android 安卓系统中的祈祷时间(ا;و;ق;ا;ت;ش;ر;ع;ی;)

Android 安卓系统中的祈祷时间(ا;و;ق;ا;ت;ش;ر;ع;ی;),android,Android,我在堆栈中尝试了此链接: 和教程,并解析了响应Json,但没有给出正确的时间。我想我在填写请求url中的gmt部分时有问题。我有位置的纬度和经度 链接示例: 在请求url中,我必须在gmt前面写什么 多谢各位 更新: public void PrayerSendReq() { long unixTime = System.currentTimeMillis() / 1000L; String urlStr = "http://api.aladhan.com/timings/

我在堆栈中尝试了此链接:

和教程,并解析了响应Json,但没有给出正确的时间。我想我在填写请求url中的gmt部分时有问题。我有位置的纬度和经度

链接示例:

在请求url中,我必须在gmt前面写什么

多谢各位

更新:

public void PrayerSendReq() {

    long unixTime = System.currentTimeMillis() / 1000L;

    String urlStr = "http://api.aladhan.com/timings/" + unixTime + "?latitude=36.2687700&longitude=50.0041000&timezonestring=Asia/Tehran&method=7";


    Log.d("Prayer url : ", urlStr);
    // Volley request queue
    RequestQueue queue = Volley.newRequestQueue(this);

    JsonObjectRequest JOReq = new JsonObjectRequest(Request.Method.GET, urlStr, (String) null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {

                    JSONObject JO = response;
                    Log.d("prayer resJson", response.toString());


                    JSONObject resultJO = new JSONObject();

                    try {
                        JSONObject items = JO.getJSONObject("data");
                        resultJO = items.getJSONObject("timings");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }


                    Log.d("Last JO : ", resultJO.toString());

                    if (resultJO != null) {


                        try {
                            fajr = resultJO.getString("Fajr");
                            editor.putString("fajr", fajr);

                            sunrise = resultJO.getString("Sunrise");
                            editor.putString("sunrise", sunrise);

                            zuhr = resultJO.getString("Dhuhr");
                            editor.putString("zuhr", zuhr);

                            azanMaghrib = resultJO.getString("Maghrib");
                            editor.putString("azanMaghrib", azanMaghrib);

                            sunset = resultJO.getString("Sunset");
                            editor.putString("sunset", sunset);

                            editor.putString("exists", "sth");

                            editor.apply();


                            azanMaghribTv.setText(String.valueOf(prefs.getString("azanMaghrib", azanMaghrib)));

                            azanSobTv.setText(String.valueOf(prefs.getString("fajr", fajr)));

                            sunriseTv.setText(String.valueOf(prefs.getString("sunrise", sunrise)));

                            azanZohrTv.setText(String.valueOf(prefs.getString("zuhr", zuhr)));

                            sunsetTv.setText(String.valueOf(prefs.getString("sunset", sunset)));


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


                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {

        }
    });

    // add it to the RequestQueue
    queue.add(JOReq);

}
    azanSobTv = (TextView) findViewById(R.id.pray_ac_sob);
    sunriseTv = (TextView) findViewById(R.id.pray_ac_toloo);
    azanZohrTv = (TextView) findViewById(R.id.pray_ac_zohr);
    azanMaghribTv = (TextView) findViewById(R.id.pray_ac_maghrib);
    sunsetTv = (TextView) findViewById(R.id.pray_ac_sunset);



    azanSobTv.setTypeface(Fonts.TrafficB);
    sunriseTv.setTypeface(Fonts.TrafficB);
    azanZohrTv.setTypeface(Fonts.TrafficB);
    azanMaghribTv.setTypeface(Fonts.TrafficB);
    sunsetTv.setTypeface(Fonts.TrafficB);

    PrayerSendReq();

    if (prefs.getString("exists", null) != null) {

        azanMaghribTv.setText(String.valueOf(prefs.getString("azanMaghrib", azanMaghrib)));

        azanSobTv.setText(String.valueOf(prefs.getString("fajr", fajr)));

        sunriseTv.setText(String.valueOf(prefs.getString("sunrise", sunrise)));

        azanZohrTv.setText(String.valueOf(prefs.getString("zuhr", zuhr)));

        sunsetTv.setText(String.valueOf(prefs.getString("sunset", sunset)));
    }
是我的解决方案,也是穆斯林祈祷时间的最佳API

这是我的代码:

public void PrayerSendReq() {

    long unixTime = System.currentTimeMillis() / 1000L;

    String urlStr = "http://api.aladhan.com/timings/" + unixTime + "?latitude=36.2687700&longitude=50.0041000&timezonestring=Asia/Tehran&method=7";


    Log.d("Prayer url : ", urlStr);
    // Volley request queue
    RequestQueue queue = Volley.newRequestQueue(this);

    JsonObjectRequest JOReq = new JsonObjectRequest(Request.Method.GET, urlStr, (String) null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {

                    JSONObject JO = response;
                    Log.d("prayer resJson", response.toString());


                    JSONObject resultJO = new JSONObject();

                    try {
                        JSONObject items = JO.getJSONObject("data");
                        resultJO = items.getJSONObject("timings");
                    } catch (JSONException e) {
                        e.printStackTrace();
                    }


                    Log.d("Last JO : ", resultJO.toString());

                    if (resultJO != null) {


                        try {
                            fajr = resultJO.getString("Fajr");
                            editor.putString("fajr", fajr);

                            sunrise = resultJO.getString("Sunrise");
                            editor.putString("sunrise", sunrise);

                            zuhr = resultJO.getString("Dhuhr");
                            editor.putString("zuhr", zuhr);

                            azanMaghrib = resultJO.getString("Maghrib");
                            editor.putString("azanMaghrib", azanMaghrib);

                            sunset = resultJO.getString("Sunset");
                            editor.putString("sunset", sunset);

                            editor.putString("exists", "sth");

                            editor.apply();


                            azanMaghribTv.setText(String.valueOf(prefs.getString("azanMaghrib", azanMaghrib)));

                            azanSobTv.setText(String.valueOf(prefs.getString("fajr", fajr)));

                            sunriseTv.setText(String.valueOf(prefs.getString("sunrise", sunrise)));

                            azanZohrTv.setText(String.valueOf(prefs.getString("zuhr", zuhr)));

                            sunsetTv.setText(String.valueOf(prefs.getString("sunset", sunset)));


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


                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {

        }
    });

    // add it to the RequestQueue
    queue.add(JOReq);

}
    azanSobTv = (TextView) findViewById(R.id.pray_ac_sob);
    sunriseTv = (TextView) findViewById(R.id.pray_ac_toloo);
    azanZohrTv = (TextView) findViewById(R.id.pray_ac_zohr);
    azanMaghribTv = (TextView) findViewById(R.id.pray_ac_maghrib);
    sunsetTv = (TextView) findViewById(R.id.pray_ac_sunset);



    azanSobTv.setTypeface(Fonts.TrafficB);
    sunriseTv.setTypeface(Fonts.TrafficB);
    azanZohrTv.setTypeface(Fonts.TrafficB);
    azanMaghribTv.setTypeface(Fonts.TrafficB);
    sunsetTv.setTypeface(Fonts.TrafficB);

    PrayerSendReq();

    if (prefs.getString("exists", null) != null) {

        azanMaghribTv.setText(String.valueOf(prefs.getString("azanMaghrib", azanMaghrib)));

        azanSobTv.setText(String.valueOf(prefs.getString("fajr", fajr)));

        sunriseTv.setText(String.valueOf(prefs.getString("sunrise", sunrise)));

        azanZohrTv.setText(String.valueOf(prefs.getString("zuhr", zuhr)));

        sunsetTv.setText(String.valueOf(prefs.getString("sunset", sunset)));
    }

您需要输入位置的时区。 请参阅时区列表


例如,如果您想要太平洋时间,请输入4。

FYI-如果您仍在使用此项,我建议您订阅邮件列表@。我还向网站添加了关于附加端点的信息。