當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonArrayRequest.setTag方法代碼示例

本文整理匯總了Java中com.android.volley.toolbox.JsonArrayRequest.setTag方法的典型用法代碼示例。如果您正苦於以下問題:Java JsonArrayRequest.setTag方法的具體用法?Java JsonArrayRequest.setTag怎麽用?Java JsonArrayRequest.setTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.android.volley.toolbox.JsonArrayRequest的用法示例。


在下文中一共展示了JsonArrayRequest.setTag方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: RequestJsonArrayGet

import com.android.volley.toolbox.JsonArrayRequest; //導入方法依賴的package包/類
public static void RequestJsonArrayGet(Context context,String url ,String tag,VolleyIntfcArray intface)
{
    arrarRequest=new JsonArrayRequest(url,intface.iListenerArrary(),intface.iErrListener());
    arrarRequest.setTag(tag);

    SelfApplication.getHttpQueues().add(arrarRequest);
    SelfApplication.getHttpQueues().start();
}
 
開發者ID:kdkler,項目名稱:VolleyJarProject,代碼行數:9,代碼來源:VolleyRequest.java

示例2: onBackgrounds

import com.android.volley.toolbox.JsonArrayRequest; //導入方法依賴的package包/類
@Override
public void onBackgrounds() {
    // 請求獲取首頁資金 titleId=2811600
    final String url = MyAPI.getBaseUrl() + "/api/Funds/FundAccount/GetAccountNameFundBalance?titleId=" + userInfoSp.getInt(AppDelegate.TITLE_ID, -1);
    JsonArrayRequest getAccountNameFundBalance = new JsonArrayRequest(Request.Method.GET, url, new Response.Listener<JSONArray>() {
        @Override
        public void onResponse(JSONArray response) {
            LogUtils.d("我的資金URL-" + url + "\n我的資金-RESPONSE:" + response.toString());
            // [{ "currency": "RMB","amount": 5823771.94,"fundAccountName": 1}]
            if (response.toString().equals("[]")) {
                mTotalFundBalance.setText("0.00");
            } else {
                List<T_AccountFundBalanceEntity> entity = JSON.parseArray(response.toString(), T_AccountFundBalanceEntity.class);

                if (entity.size() != 0) {
                    GeneralAccount = entity.get(0).getAmount();
                }

                if (entity.size() > 2) {
                    FinancingAccount = entity.get(2).getAmount();
                }

                TotalFundBalance = GeneralAccount + FinancingAccount;
                mTotalFundBalance.setText(StringUtil.numberFormat(TotalFundBalance));
            }

            hideProgressbar();
        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            LogUtils.e("請求錯誤:" + error.toString());
            mTotalFundBalance.setText("0.00");
            hideProgressbar();
        }
    }
    ) {
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String, String> map = new HashMap<>();
            map.put(AppDelegate.QS_LOGIN, userInfoSp.getString(AppDelegate.LOGIN_NAME, ""));
            return map;
        }
    };

    getAccountNameFundBalance.setTag(this);
    mRequestQueue.add(getAccountNameFundBalance);

}
 
開發者ID:jpaijh,項目名稱:TYT,代碼行數:50,代碼來源:HomeFragment.java

示例3: onBackgrounds

import com.android.volley.toolbox.JsonArrayRequest; //導入方法依賴的package包/類
@Background
public void onBackgrounds() {
    // 發票信息 詳情頁-商品詳情 http://101.200.194.102:10104/api/Funds/VatRegister/FindVatInvoiceDetails?ownerId=2962926
    T_InvoiceInformationEntity.RowsEntity rowsEntity = (T_InvoiceInformationEntity.RowsEntity) getIntent().getSerializableExtra("rowsEntity");
    if (rowsEntity != null) {
        final String url = MyAPI.getBaseUrl() + "/api/Funds/VatRegister/FindVatInvoiceDetails?owerId=" + rowsEntity.getId();

        JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.GET, url, new Response.Listener<JSONArray>() {
            @Override
            public void onResponse(JSONArray response) {
                LogUtils.d("\n發票信息-商品詳情-URL:" + url + "\n發票信息-商品詳情-RESPONSE:" + response.toString());

                List<T_InvoiceInformationProductsEntity> invoiceInformationProductsEntities =
                        JSON.parseArray(response.toString(), T_InvoiceInformationProductsEntity.class);

                if (invoiceInformationProductsEntities.size() == 0) {
                    showView(tv_no_data);
                } else {
                    hideView(tv_no_data);
                }

                if (invoiceInformationProductsEntities != null) {
                    mAdapter = new MyInvoiceInformationProductsAdapter(invoiceInformationProductsEntities);
                    mRecyclerView.setAdapter(mAdapter);
                }

                if (!isFirstLoading)
                    createRefreshCompleteSnackbar(mRecyclerView);

                mSwipeRefreshLayout.setRefreshing(false);
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                LogUtils.e("請求錯誤:" + error.toString());
            }
        }) {
            @Override
            public Map<String, String> getHeaders() throws AuthFailureError {
                Map<String, String> map = new HashMap<>();
                map.put(AppDelegate.QS_LOGIN, MyApplication_.getInstance().getUserInfoSp().getString(AppDelegate.LOGIN_NAME, ""));
                return map;
            }
        };

        jsonArrayRequest.setTag(this);
        mRequestQueue.add(jsonArrayRequest);
    }

}
 
開發者ID:jpaijh,項目名稱:TYT,代碼行數:51,代碼來源:T_InvoiceInformationProductsActivity.java

示例4: requestYLR

import com.android.volley.toolbox.JsonArrayRequest; //導入方法依賴的package包/類
/**
 * 進倉管理-經營單位:請求查看預錄入單
 */
@Background
void requestYLR() {
    final String url = MyAPI.getBaseUrl() + "/api/Orders/Storage/ResolvePreCustomsDeclaration?blNo=" + blNo;
    JsonArrayRequest ylrRequest = new JsonArrayRequest(Request.Method.POST, url, new Response.Listener<JSONArray>() {
        @Override
        public void onResponse(JSONArray response) {
            String res = response.toString();
            LogUtils.d("\n預錄入單-URL:" + url + "\n預錄入單-RESPONSE:" + res);
            //  [ {"blNo": "NGBNYC028386","customsDeclarationNo": "310420160549945415","queryUrl": "http://lh.nbytg.com/WebApp/AgentManage/biz/YTGEntryPage.aspx?t1=310420160549945415&t2=lh.nbytg.com"}]
            if (res.equals("[]")) {
                mProgressDialog.dismiss();
                ToastUtil.showToast(CB_ManageDetailsActivity.this, "提單編號 [" + blNo + "] 查詢的預錄入單不存在");
            } else {
                mProgressDialog.dismiss();
                com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(JSON.parseArray(res).get(0).toString());
                String customsDeclarationNo = jsonObject.getString("customsDeclarationNo");
                String queryUrl = jsonObject.getString("queryUrl");
                CB_WebActivity_.intent(CB_ManageDetailsActivity.this).extra(AppDelegate.URL, queryUrl).extra(AppDelegate.TOOLBAR_TITLE, "海關編號-" + customsDeclarationNo).start();
            }

        }
    }, new Response.ErrorListener() {
        @Override
        public void onErrorResponse(VolleyError error) {
            LogUtils.e("預錄入單:" + error.toString());
            mProgressDialog.dismiss();
            ToastUtil.showToast(CB_ManageDetailsActivity.this, "查詢請求超時,請稍後再試");
        }
    }) {
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String, String> map = new HashMap<>();
            map.put("Content-Type", "application/x-www-form-urlencoded");
            return map;
        }
    };

    ylrRequest.setTag(this);
    mRequestQueue.add(ylrRequest);

}
 
開發者ID:jpaijh,項目名稱:TYT,代碼行數:45,代碼來源:CB_ManageDetailsActivity.java

示例5: getAuthProviders

import com.android.volley.toolbox.JsonArrayRequest; //導入方法依賴的package包/類
/**
 * Gets all available auth providers for the current app.
 *
 * @return A task containing {@link AvailableAuthProviders} that can be resolved on completion
 * of the request.
 */
public Task<AvailableAuthProviders> getAuthProviders() {

    final TaskCompletionSource<AvailableAuthProviders> future = new TaskCompletionSource<>();
    final String url = getResourcePath(routes.AUTH_PROVIDERS);

    final JsonArrayRequest request = new JsonArrayRequest(
            Request.Method.GET,
            url,
            new Response.Listener<JSONArray>() {
                @Override
                public void onResponse(final JSONArray response) {
                    final AvailableAuthProviders.Builder builder = new AvailableAuthProviders.Builder();
                    for (int i = 0; i < response.length(); i++) {
                        try {
                            JSONObject info = response.getJSONObject(i);
                            switch (info.getString("type")) {
                                case FacebookAuthProviderInfo.FQ_NAME:
                                    final FacebookAuthProviderInfo fbInfo =
                                            _objMapper.readValue(info.toString(), FacebookAuthProviderInfo.class);
                                    builder.withFacebook(fbInfo);
                                    break;
                                case GoogleAuthProviderInfo.FQ_NAME:
                                    final GoogleAuthProviderInfo googleInfo =
                                            _objMapper.readValue(info.toString(), GoogleAuthProviderInfo.class);
                                    builder.withGoogle(googleInfo);
                                    break;
                                case AnonymousAuthProviderInfo.FQ_NAME:
                                    final AnonymousAuthProviderInfo anonInfo =
                                            _objMapper.readValue(info.toString(), AnonymousAuthProviderInfo.class);
                                    builder.withAnonymous(anonInfo);
                                    break;
                                case EmailPasswordAuthProviderInfo.FQ_NAME:
                                    final EmailPasswordAuthProviderInfo emailPassInfo =
                                            _objMapper.readValue(info.toString(), EmailPasswordAuthProviderInfo.class);
                                    builder.withEmailPass(emailPassInfo);
                                    break;
                                case CustomAuthProviderInfo.FQ_NAME:
                                    final CustomAuthProviderInfo customAuthProviderInfo =
                                            _objMapper.readValue(info.toString(), CustomAuthProviderInfo.class);
                                    builder.withCustomAuth(customAuthProviderInfo);
                            }
                        } catch (JSONException | IOException e) {
                            Log.e(
                                    TAG,
                                    "Error while getting auth provider info",
                                    e);
                            future.setException(e);
                            return;
                        }
                    }
                    future.setResult(builder.build());
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(final VolleyError error) {
                    Log.e(TAG, "Error while getting auth provider info", error);
                    future.setException(parseRequestError(error));
                }
            });
    request.setTag(this);
    _queue.add(request);

    return future.getTask();
}
 
開發者ID:mongodb,項目名稱:stitch-android-sdk,代碼行數:72,代碼來源:StitchClient.java

示例6: downloadMovieReviews

import com.android.volley.toolbox.JsonArrayRequest; //導入方法依賴的package包/類
private void downloadMovieReviews() {
    if (adapter == null) {
        adapter = new ReviewAdapter(new ArrayList<Review>(), this);
        reviewList.setAdapter(adapter);
    }
    JsonArrayRequest request = new JsonArrayRequest(
            Request.Method.GET, ApiHelper.getMovieReviewsLink(movieId, pageToDownload), null,
            new Response.Listener<JSONArray>() {
                @Override
                public void onResponse(JSONArray array) {
                    try {
                        for (int i = 0; i < array.length(); i++) {
                            JSONObject review = array.getJSONObject(i);

                            String id = review.getString("id");
                            String comment = review.getString("comment");
                            boolean hasSpoiler = review.getBoolean("spoiler");

                            // Get date and format it
                            String inputTime = review.getString("created_at").substring(0, 10);
                            DateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
                            Date date = inputFormat.parse(inputTime);
                            DateFormat outputFormat = new SimpleDateFormat("dd MMM yyyy");
                            String createdAt = outputFormat.format(date);

                            // Get user name
                            JSONObject user = review.getJSONObject("user");
                            String userName = user.getString("username");
                            if (!user.getBoolean("private")) {
                                String name = user.getString("name");
                                if (!TextUtil.isNullOrEmpty(name)) {
                                    userName = name;
                                }
                            }

                            adapter.reviewList.add(new Review(id, userName, comment, createdAt, hasSpoiler));
                        }

                        onDownloadSuccessful();

                    } catch (Exception ex) {
                        // Parsing error
                        onDownloadFailed();
                    }
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError volleyError) {
                    if (volleyError.networkResponse.statusCode == 404 || volleyError.networkResponse.statusCode == 405) {
                        // No such movie exists
                        onDownloadSuccessful();
                    } else {
                        // Network error, failed to load
                        onDownloadFailed();
                    }
                }
            }) {
                // Add Request Headers
                @Override
                public Map<String, String> getHeaders() throws AuthFailureError {
                    Map<String, String>  params = new HashMap<>();
                    params.put("Content-type", "application/json");
                    params.put("trakt-api-key", ApiHelper.getTraktKey(getContext()));
                    params.put("trakt-api-version", "2");
                    return params;
                }
                // Get Response Headers
                @Override
                protected Response<JSONArray> parseNetworkResponse(NetworkResponse response) {
                    pageToDownload = Integer.parseInt(response.headers.get("X-Pagination-Page")) + 1;
                    totalPages = Integer.parseInt(response.headers.get("X-Pagination-Page-Count"));
                    return super.parseNetworkResponse(response);
                }
            };
    isLoading = true;
    request.setTag(getClass().getName());
    VolleySingleton.getInstance().requestQueue.add(request);
}
 
開發者ID:Ronak-LM,項目名稱:watchlist,代碼行數:80,代碼來源:ReviewFragment.java


注:本文中的com.android.volley.toolbox.JsonArrayRequest.setTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。