当前位置: 首页>>代码示例>>Java>>正文


Java VolleyError.printStackTrace方法代码示例

本文整理汇总了Java中com.android.volley.VolleyError.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java VolleyError.printStackTrace方法的具体用法?Java VolleyError.printStackTrace怎么用?Java VolleyError.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.volley.VolleyError的用法示例。


在下文中一共展示了VolleyError.printStackTrace方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: requestPersonCredits

import com.android.volley.VolleyError; //导入方法依赖的package包/类
private static void requestPersonCredits(String url, final GetMoviesCallback callback,
                                     Activity activity) {
    JsonObjectRequest request = new JsonObjectRequest(Request.Method.GET, url, null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    callback.successGetMovies(MoviesMapping.getMoviesFromCredits(response));
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    error.printStackTrace();
                    callback.errorGetMovies();
                }
            });
    VolleyHelper.getInstance(activity).addToRequestQueue(request, activity);
}
 
开发者ID:JonathandelaSen,项目名称:TheMovies,代码行数:19,代码来源:PeopleTask.java

示例2: fetchLatestVersion

import com.android.volley.VolleyError; //导入方法依赖的package包/类
public static void fetchLatestVersion(final ModelListener<String> listener) {
    JsonObjectRequest r = new JsonObjectRequest(Request.Method.GET, baseURL + "/latest", null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    try {
                        JSONObject result = response.getJSONObject("result");
                        String version = result.getString("android");
                        listener.onData(version, "ok");
                    } catch (Exception e) {
                        e.printStackTrace();
                        listener.onData(null, "服务器通信失败 (1)");
                    }
                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
            listener.onData(null, "服务器通信失败 (1)");
        }
    });
    SAGlobal.sharedRequestQueue.add(r);
}
 
开发者ID:njitdev,项目名称:sa-android,代码行数:24,代码来源:VersionModels.java

示例3: fetchArticleBody

import com.android.volley.VolleyError; //导入方法依赖的package包/类
public static void fetchArticleBody(String articleID, final ModelListener<String> listener) {
    JsonObjectRequest r = new JsonObjectRequest(Request.Method.GET, articleURL + "?article_id=" + articleID, null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    try {
                        JSONObject article = response.getJSONObject("result");
                        String article_body = article.getString("article_body");
                        listener.onData(article_body, "ok");
                    } catch (JSONException e) {
                        e.printStackTrace();
                        listener.onData(null, "获取通知信息失败");
                    }
                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
            listener.onData(null, "获取通知信息失败");
        }
    });
    SAGlobal.sharedRequestQueue.add(r);
}
 
开发者ID:njitdev,项目名称:sa-android,代码行数:24,代码来源:AnnouncementModels.java

示例4: moveCar

import com.android.volley.VolleyError; //导入方法依赖的package包/类
public void moveCar(String method) {

        Log.i("testAdress", "start");
        RequestQueue queue = Volley.newRequestQueue(getContext());
        String url = API_URI + method;
        Log.i("url", url);
        // Request a string response from the provided URL.
        StringRequest stringRequest = new StringRequest(Request.Method.GET, url,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {
                        // Display the first 500 characters of the response string.
                        int stringLength = response.length();
                        //testResult.setText("Response is: " + response.substring(0, stringLength - 1));
                        Log.i("Response", response.substring(0, stringLength - 1));
                    }
                }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e("Response ERROR",error.toString());
                //testResult.setText("That didn't work!");
                error.printStackTrace();
            }
        });
        // Add the request to the RequestQueue.
        queue.add(stringRequest);
    }
 
开发者ID:matthiasSchedel,项目名称:Car2Play,代码行数:28,代码来源:DrawingView.java

示例5: onErrorResponse

import com.android.volley.VolleyError; //导入方法依赖的package包/类
@Override
public void onErrorResponse(VolleyError error) {
    if (DEBUG){
        Timber.e("Image Load Error: %s", error.getMessage());
        error.printStackTrace();
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:8,代码来源:ChatBubbleImageView.java

示例6: sendTwilioText

import com.android.volley.VolleyError; //导入方法依赖的package包/类
public void sendTwilioText(final String num,final String eventName){
        // POST method here
        StringRequest postRequest = new StringRequest(Request.Method.POST, URL,
                new Response.Listener<String>() {
                    @Override
                    public void onResponse(String response) {

//                            JSONObject jsonResponse = new JSONObject(response).getJSONObject("form");
//                            String site = jsonResponse.getString("site"),
//                                    network = jsonResponse.getString("network");
//                            System.out.println("Site: "+site+"\nNetwork: "+network);
                        Toast.makeText(getActivity(),"Invitation successfully sent",Toast.LENGTH_LONG).show();
                        twilioText.setText("");

                    }
                },
                new Response.ErrorListener() {
                    @Override
                    public void onErrorResponse(VolleyError error) {
                        error.printStackTrace();
                    }
                }
        ) {
            @Override
            protected Map<String, String> getParams()
            {


                Map<String, String>  params = new HashMap<>();
                // the POST parameters:

                params.put("num", num);
                params.put("event",eventName);
                return params;
            }
        };
        Volley.newRequestQueue(getActivity()).add(postRequest);
    }
 
开发者ID:rohansapre,项目名称:cleanhood,代码行数:39,代码来源:EventDetailsFragmentHost.java

示例7: createRequestErrorListener

import com.android.volley.VolleyError; //导入方法依赖的package包/类
private Response.ErrorListener createRequestErrorListener() {
    return new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
        }
    };
}
 
开发者ID:ayushghd,项目名称:iSPY,代码行数:9,代码来源:ShortestDistance.java

示例8: deliverError

import com.android.volley.VolleyError; //导入方法依赖的package包/类
@Override
public void deliverError(VolleyError e) {
    if (isCanceled()) {
        return;
    }
    e.printStackTrace();
    if (mResponse != null) {
        mResponse.onError(new AbstractResponse.Response(e));
    }
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:11,代码来源:BaseRequest.java

示例9: onErrorResponse

import com.android.volley.VolleyError; //导入方法依赖的package包/类
@Override
public void onErrorResponse(VolleyError error) {
    error.printStackTrace();
    mCallback.onError(error);
    mCallback = null;
}
 
开发者ID:feifadaima,项目名称:https-github.com-hyb1996-NoRootScriptDroid,代码行数:7,代码来源:UpdateChecker.java

示例10: fetchArticleList

import com.android.volley.VolleyError; //导入方法依赖的package包/类
public static void fetchArticleList(int category, final ModelListener<List<Article>> listener) {
    JsonObjectRequest r = new JsonObjectRequest(Request.Method.GET, baseURL + "?category=" + category, null,
            new Response.Listener<JSONObject>() {

                @Override
                public void onResponse(JSONObject response) {
                    try {
                        JSONArray result = response.getJSONArray("result");
                        List<Article> list = new ArrayList<>();

                        for (int i = 0; i < result.length(); i++) {
                            JSONObject object = result.getJSONObject(i);

                            Article article = new Article();

                            // Required fields
                            article.article_id = object.getString("article_id");
                            article.article_title = object.getString("article_title");

                            // Optional fields
                            if (object.has("article_department"))
                                article.article_department = object.getString("article_department");
                            if (object.has("article_date"))
                                article.article_date = object.getString("article_date");

                            list.add(article);
                        }
                        listener.onData(list, "ok");
                    } catch (Exception e) {
                        e.printStackTrace();
                        listener.onData(null, "获取通知信息失败");
                    }
                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
            listener.onData(null, "获取通知信息失败");
        }
    });
    SAGlobal.sharedRequestQueue.add(r);
}
 
开发者ID:njitdev,项目名称:sa-android,代码行数:43,代码来源:AnnouncementModels.java

示例11: fetchList

import com.android.volley.VolleyError; //导入方法依赖的package包/类
public static void fetchList(int page, final ModelListener<List<Post>> listener) {
    JsonObjectRequest r = new JsonObjectRequest(Request.Method.GET, baseURL + "/posts?page=" + page, null,
            new Response.Listener<JSONObject>() {
                @Override
                public void onResponse(JSONObject response) {
                    try {
                        JSONObject result = response.getJSONObject("result");
                        JSONArray posts = result.getJSONArray("posts");

                        // Generate result
                        ArrayList<Post> list = new ArrayList<>();
                        for (int i = 0; i < posts.length(); i++) {
                            JSONObject post = posts.getJSONObject(i);

                            Post p = new Post();

                            // Required fields
                            p.user_name = post.getString("user_name");
                            p.text = post.getString("text");
                            p.creation_time = post.getString("creation_time");

                            // Optional fields
                            if (post.has("user_title") && !post.isNull("user_title"))
                                p.user_title = post.getString("user_title");
                            if (post.has("user_department") && !post.isNull("user_title"))
                                p.user_department = post.getString("user_department");

                            list.add(p);
                        }
                        listener.onData(list, "ok");
                    } catch (Exception e) {
                        e.printStackTrace();
                        listener.onData(null, "获取留言失败");
                    }
                }
            }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
            listener.onData(null, "获取留言失败");
        }
    });
    SAGlobal.sharedRequestQueue.add(r);
}
 
开发者ID:njitdev,项目名称:sa-android,代码行数:45,代码来源:MessageBoardModels.java

示例12: downloadRate

import com.android.volley.VolleyError; //导入方法依赖的package包/类
private void downloadRate() {
    commentslist.clear();
    StringRequest strReq = new StringRequest(Request.Method.POST,
                                             AppConfig.URL_RATEDETAIL, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            try {


                JSONObject jObj = new JSONObject(response);
                JSONArray feedArray = jObj.getJSONArray("rate");
                ratee = new Rate();
                for (int i = 0; i < feedArray.length(); i++) {
                    final JSONObject feedObj = (JSONObject) feedArray.get(i);
                    System.out.println(feedObj);
                    //add product to list product





                        //add product to list products

                        //add product to sqlite

                    switch (feedObj.getInt("point")) {
                        case 1:
                            ratee.onestar +=1;

                            break;
                        case 2:
                            ratee.twostar +=1;

                            break;
                        case 3:
                            ratee.threestar +=1;

                            break;
                        case 4:
                            ratee.fourstar+=1;

                            break;
                        case 5:
                            ratee.fivestar +=1;

                            break;

                    }
                    favoritecount = jObj.getString("count");
                    Comments comment = new Comments(feedObj.getString("userid"), feedObj.getString("username"),feedObj.getString("time"),
                                                    feedObj.getString("contentcomment"), feedObj.getString("userpic"), feedObj.getString("point"));
                    commentslist.add(comment);
                }
                onDownloadRateSuccessful();

            } catch (Exception ex) {
                // JSON parsing error
                ex.printStackTrace();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
        }
    }) {
        @Override
        protected Map<String, String> getParams() {
            // Posting parameters to login url
            Map<String, String> params = new HashMap<>();
            params.put("userid", sellerid + "");
            return params;
        }
    };
    strReq.setTag(this.getClass().getName());
    VolleySingleton.getInstance(getActivity()).requestQueue.add(strReq);
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:78,代码来源:PersonalDetailFragment.java

示例13: downloadproductDetails

import com.android.volley.VolleyError; //导入方法依赖的package包/类
private void downloadproductDetails(final String id) {
    String urlToDownload = AppConfig.URL_PRODUCTDETAIL;
    StringRequest strReq = new StringRequest(Request.Method.POST,
                                             urlToDownload, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            Log.d("ok", "Login Response: " + response);
            try {
                JSONObject jObj = new JSONObject(response);
                JSONObject feedObj = jObj.getJSONObject("product");
                ArrayList<String> productimg = new ArrayList<>(Arrays.asList(feedObj.getString("productimage").split(",")));
                //add product to list products
                product = new Product(feedObj.getInt("productid"),
                                      feedObj.getString("productname"),
                                      feedObj.getLong("price") / rate,
                                      feedObj.getInt("userid"),
                                      feedObj.getString("username"),
                                      feedObj.getString("categoryname"),
                                      feedObj.getString("productaddress"),
                                      feedObj.getString("areaproduct"),
                                      feedObj.getString("productstatus"),
                                      productimg,
                                      feedObj.getString("productdate"),
                                      feedObj.getString("description"),
                                      feedObj.getString("sharecount"),
                                      Double.parseDouble(feedObj.getString("lat")),
                                      Double.parseDouble(feedObj.getString("lot"))
                );
                seller = new User();
                seller.userid = Integer.parseInt(feedObj.getString("userid"));
                seller.setEmail(feedObj.getString("email"));
                seller.setPhone(feedObj.getString("phone"));
                seller.userpic = (feedObj.getString("userpic"));
                seller.count = feedObj.getString("count");
                if(feedObj.getString("rate").equals("null"))
                    seller.rate = "0";
                else
                {
                    seller.rate = (double) Math.round(Double.parseDouble(feedObj.getString("rate")) * 10) / 10 + "";
                }

                point = feedObj.getString("point");
                favorite = feedObj.getString("favorite");
                onDownloadSuccessful();
            } catch (JSONException e) {
                // JSON error
                e.printStackTrace();
                onDownloadFailed();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            onDownloadFailed();
            error.printStackTrace();
        }
    }) {
        @Override
        protected Map<String, String> getParams() {
            // Posting parameters to login url
            Map<String, String> params = new HashMap<>();
            params.put("productid", id);
            params.put("userrated", session.getLoginId()+"");
            params.put("userrating", sellerid);
            return params;
        }
    };
    strReq.setTag(this.getClass().getName());
    VolleySingleton.getInstance(getActivity()).requestQueue.add(strReq);
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:71,代码来源:PersonalDetailFragment.java

示例14: downloadRate

import com.android.volley.VolleyError; //导入方法依赖的package包/类
private void downloadRate() {
    StringRequest strReq = new StringRequest(Request.Method.POST,
                                             AppConfig.URL_RATEDETAILPROFILE, new Response.Listener<String>() {
        @Override
        public void onResponse(String response) {
            try {

                JSONObject jObj = new JSONObject(response);
                JSONArray feedArray = jObj.getJSONArray("rate");
                ratee = new Rate();
                for (int i = 0; i < feedArray.length(); i++) {
                    final JSONObject feedObj = (JSONObject) feedArray.get(i);
                    //add product to list product

                    switch (feedObj.getInt("point")) {
                        case 1:
                            ratee.onestar = Integer.parseInt(feedObj.getString("count"));

                            break;
                        case 2:
                            ratee.twostar = Integer.parseInt(feedObj.getString("count"));

                            break;
                        case 3:
                            ratee.threestar = Integer.parseInt(feedObj.getString("count"));

                            break;
                        case 4:
                            ratee.fourstar = Integer.parseInt(feedObj.getString("count"));

                            break;
                        case 5:
                            ratee.fivestar = Integer.parseInt(feedObj.getString("count"));

                            break;
                    }

                }
                Log.e("favorites", response);
                rate1 = jObj.getString("rate1");
                point1 = jObj.getString("count");
                countfavorites = jObj.getString("countfavorites");
                Log.e("RATEOK", "rate: " + rate1 + " " + "point: " + point1);
                onDownloadRateSuccessful();
                onDownloadSuccessful();
            } catch (Exception ex) {
                // JSON parsing error
                ex.printStackTrace();
            }
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            error.printStackTrace();
        }
    }) {
        @Override
        protected Map<String, String> getParams() {
            // Posting parameters to login url
            Map<String, String> params = new HashMap<>();
            params.put("userid", sellerid + "");
            return params;
        }
    };
    strReq.setTag(this.getClass().getName());
    VolleySingleton.getInstance(getActivity()).requestQueue.add(strReq);
}
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:68,代码来源:ProfileDetailFragment.java

示例15: downloadproductDetails

import com.android.volley.VolleyError; //导入方法依赖的package包/类
private void downloadproductDetails(final String id) {
        String urlToDownload = AppConfig.URL_PRODUCTDETAIL;
        StringRequest strReq = new StringRequest(Request.Method.POST,
                urlToDownload, new Response.Listener<String>() {
            @Override
            public void onResponse(String response) {
                Log.d("ok", "Login Response: " + response);
                try {
                    JSONObject jObj = new JSONObject(response);
                    JSONObject feedObj = jObj.getJSONObject("product");
                    ArrayList<String> productimg = new ArrayList<>(Arrays.asList(feedObj.getString("productimage").split(",")));
                    //add product to list products
                    product = new Product(feedObj.getInt("productid"),
                            feedObj.getString("productname"),
                            feedObj.getLong("price") / rate,
                            feedObj.getInt("userid"),
                            feedObj.getString("username"),
                            feedObj.getString("categoryname"),
                            feedObj.getString("productaddress"),
                            feedObj.getString("areaproduct"),
                            feedObj.getString("productstatus"),
                            productimg,
                            feedObj.getString("productdate"),
                            feedObj.getString("description"),
                            feedObj.getString("sharecount"),
                            Double.parseDouble(feedObj.getString("lat")),
                            Double.parseDouble(feedObj.getString("lot"))
                    );
                    seller = new User();
                    seller.setEmail(feedObj.getString("email"));
                    seller.setPhone(feedObj.getString("phone"));
                    point = feedObj.getString("point");

//                    JSONArray feedArray = feedObj.getJSONArray("comments");
//                    commentslist.clear();
//                    for (int i = 0; i < feedArray.length(); i++) {
//                        final JSONObject feedComment = (JSONObject) feedArray.get(i);
//                        //add product to list products
//                        Comments comment = new Comments(feedComment.getString("userid"), feedComment.getString("username"), feedComment.getString("productid"), feedComment.getString("time"),
//                                                        feedComment.getString("contentcomment"), feedComment.getString("userpic"), feedComment.getString("rate"));
//                        commentslist.add(comment);
//                        //add product to sqlite
//                    }
                    onDownloadSuccessful();
                } catch (JSONException e) {
                    // JSON error
                    e.printStackTrace();
                    onDownloadFailed();
                }
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                onDownloadFailed();
                error.printStackTrace();
            }
        }) {
            @Override
            protected Map<String, String> getParams() {
                // Posting parameters to login url
                Map<String, String> params;
                params = new HashMap<String, String>();
                params.put("productid", id);
                params.put("userrated", String.valueOf(session.getLoginId()));
                params.put("userrating", userid);
                return params;
            }
        };
        strReq.setTag(this.getClass().getName());
        VolleySingleton.getInstance(getActivity()).requestQueue.add(strReq);
    }
 
开发者ID:sega4revenge,项目名称:Sega,代码行数:72,代码来源:ProductDetailFragmentUser.java


注:本文中的com.android.volley.VolleyError.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。