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


Java ResponseInfo類代碼示例

本文整理匯總了Java中com.lidroid.xutils.http.ResponseInfo的典型用法代碼示例。如果您正苦於以下問題:Java ResponseInfo類的具體用法?Java ResponseInfo怎麽用?Java ResponseInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: login

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
@OnClick(R.id.login_button_myFragment)
public void login(View v){
    String phone = telephoneNum.getText().toString();
    String password = passWord.getText().toString();
    if(phone!=null&&password!=null){
        httpUtils.send(HttpRequest.HttpMethod.GET, UrlsConfig.LOGIN, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {

            }

            @Override
            public void onFailure(HttpException e, String s) {

            }
        });
    }else{
        Toast.makeText(getActivity(), "信息不完整", Toast.LENGTH_SHORT);
    }
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:21,代碼來源:MyFragment.java

示例2: loadData

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
private void loadData(String url) {
    httpUtils = new HttpUtils();
    httpUtils.send(HttpRequest.HttpMethod.POST, url, new RequestCallBack<String>() {

        @Override
        public void onSuccess(ResponseInfo<String> responseInfo) {
            String json = responseInfo.result;
            homeBean = JSON.parseObject(json, HomeBean.class);
            List<HomeBean.DataEntity.App_index_recommandEntity> list1 = homeBean.getData().getApp_index_recommand();
            if (homeBean != null) {
                View headView = getHeadView(inflater);
                ptrlistview.getRefreshableView().addHeaderView(headView);
            }
            list.addAll(list1);
            adapter.notifyDataSetChanged();
        }

        @Override
        public void onFailure(HttpException e, String s) {
            Toast.makeText(getActivity(), "加載數據失敗", Toast.LENGTH_SHORT).show();
            View view = ViewStub.inflate(getActivity(),R.layout.faild_layout,null);
        }
    });
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:25,代碼來源:HomeFragment.java

示例3: loadData

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
private void loadData() {
    HttpUtils httpUtils = new HttpUtils();
    httpUtils.send(HttpRequest.HttpMethod.POST, UrlsConfig.HUODONG_DETAIL_URL, new RequestCallBack<String>() {
        @Override
        public void onSuccess(ResponseInfo<String> responseInfo) {
            String json = responseInfo.result;
             huoDongBean = JSON.parseObject(json, HuoDongBean.class);
            HuoDongBean.DataEntity.Index_activity_itemEntity  itemEntivity = huoDongBean.getData().getIndex_activity_item();
            bitmapUtils.display(huodong_headview_img,itemEntivity.getImage_url());
            huodong_upimg_name.setText(itemEntivity.getName());
            huodong_people_time.setText(itemEntivity.getActivity_time_tip() + "  " + itemEntivity.getMember_count() + "人參加");
            huodong_huodong_detail_textview.setText(itemEntivity.getDesc());
            List<HuoDongBean.DataEntity.Activity_share_itemEntity> list1 = huoDongBean.getData().getActivity_share_item();
            list.addAll(list1);
            adapter.notifyDataSetChanged();
        }

        @Override
        public void onFailure(HttpException e, String s) {
            Toast.makeText(getApplicationContext(), "數據加載失敗", Toast.LENGTH_SHORT).show();
        }
    });
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:24,代碼來源:HDdetailActivity.java

示例4: loadData

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
private void loadData(String URL) {
    HttpUtils httpUtils = new HttpUtils();
    httpUtils.send(HttpRequest.HttpMethod.GET, URL, new RequestCallBack<String>() {
        @Override
        public void onSuccess(ResponseInfo<String> responseInfo) {
            String str = responseInfo.result;
            SearchGrid searchGrid = JSONObject.parseObject(str, SearchGrid.class);
            List<SearchGrid.DataEntity.App_share_dish_list_by_propertyEntity> list = searchGrid.getData().getApp_share_dish_list_by_property();
            if (list != null && list.size() > 0) {
                datas.addAll(list);
                adapter.notifyDataSetChanged();
            }
        }

        @Override
        public void onFailure(HttpException e, String s) {

        }
    });
}
 
開發者ID:liupengandroid,項目名稱:ywApplication,代碼行數:21,代碼來源:GirdViewActivity.java

示例5: get

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
/**
 * get請求 
 * @param url 請求路徑
 * @param requestCallBackListener 請求回調
 */
public static void get(String url , final RequestCallBackListener requestCallBackListener){
	http.configTimeout(1000*10);
	http.send(HttpMethod.GET, url, new RequestCallBack<String>() {

		@Override
		public void onSuccess(ResponseInfo<String> response) {
			requestCallBackListener.onSuccess(response.result);
		}
		
		@Override
		public void onFailure(HttpException error, String msg) {
			requestCallBackListener.onFailure(msg);
		}
	});
}
 
開發者ID:Catslovetoplaygames,項目名稱:MVP,代碼行數:21,代碼來源:HttpRequest.java

示例6: post

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
/**
 * post請求
 * @param url	請求地址
 * @param params	請求參數
 * @param requestCallBackListener	請求回調
 */
public static void post(String url ,RequestParams params , final RequestCallBackListener requestCallBackListener){
	http.configTimeout(1000*10);
	http.send(HttpMethod.POST, url, params, new RequestCallBack<String>() {

		@Override
		public void onSuccess(ResponseInfo<String> response) {
			requestCallBackListener.onSuccess(response.result);
		}
		
		@Override
		public void onFailure(HttpException error, String msg) {
			requestCallBackListener.onFailure(msg);
		}
	});
}
 
開發者ID:Catslovetoplaygames,項目名稱:MVP,代碼行數:22,代碼來源:HttpRequest.java

示例7: download

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
public static void download(String url, String path,
		final IOAuthCallBack iOAuthCallBack) {
	HttpUtils http = new HttpUtils();
	HttpHandler<File> handler = http.download(url, path, false, // 如果目標文件存在,接著未完成的部分繼續下載。服務器不支持RANGE時將從新下載。
			false, // 如果從請求返回信息中獲取到文件名,下載完成後自動重命名。
			new RequestCallBack<File>() {

				@Override
				public void onSuccess(ResponseInfo<File> arg0) {
					if (d)
						Log.d("-----downfile-----", "success");
					iOAuthCallBack.getIOAuthCallBack(arg0.result.getName(),
							0);
				}

                   @Override
                   public void onFailure(com.lidroid.xutils.exception.HttpException e, String s) {
                       if (d)
                           Log.d("-----downfile-----", "fail");
                       iOAuthCallBack.getIOAuthCallBack(e.toString(), 1);
                   }
               });
}
 
開發者ID:Evan-Galvin,項目名稱:FreeStreams-TVLauncher,代碼行數:24,代碼來源:Tools.java

示例8: getDataFromServer

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
private void getDataFromServer() {
	HttpUtils httpUtils = new HttpUtils();
	httpUtils.send(HttpMethod.GET, mUrl, new RequestCallBack<String>() {

		@Override
		public void onSuccess(ResponseInfo<String> responseInfo) {
			String result = responseInfo.result;
			processData(result);
			
			//���û���
			CacheUtils.setCache(mUrl, result, mActivity);
		}

		@Override
		public void onFailure(HttpException error, String msg) {
			error.printStackTrace();
			Toast.makeText(mActivity, msg, Toast.LENGTH_SHORT).show();
		}
	});
	
}
 
開發者ID:unique5954,項目名稱:zhbj74,代碼行數:22,代碼來源:TabDetailPager.java

示例9: checkForUpdate

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
/**
 * 連接服務器檢查更新
 * 
 * @author: cl
 * @param context
 * @date: 2016-2-19-下午2:45:34
 */
public static void checkForUpdate(Context context) {
	UpdateUtil.context = context;
	// 連接服務器獲取json
	// 請求結果會進入緩存,持續時間大概30s,1min內
	// 緩存存在期間,請求該鏈接會直接調用回調函數RequestCallBack,使用緩存中的返回結果
	HttpUtils http = new HttpUtils();
	http.send(HttpMethod.GET, UpdateUtil.URL_JSON,
			new RequestCallBack<String>() {

				@Override
				public void onFailure(HttpException httpexception, String s) {
					Toast.makeText(
							UpdateUtil.context,
							"無法連接到服務器(" + httpexception.getExceptionCode()
									+ ")", Toast.LENGTH_SHORT).show();

				}

				@Override
				public void onSuccess(ResponseInfo<String> responseinfo) {
					alertUpdate(responseinfo.result);
				}
			});

}
 
開發者ID:Cheng-Long,項目名稱:WuYouHelper,代碼行數:33,代碼來源:UpdateUtil.java

示例10: downloadNewApk

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
/**
 * 下載新版本
 * @param
 */
protected void downloadNewApk(String apkurl) {
    DownLoadUtils downLoadUtils = new DownLoadUtils();
    downLoadUtils.downAPK(apkurl, "mobilesafe2.0.apk", new DownLoadUtils.MyCallBack() {
        @Override
        public void onSuccess(ResponseInfo<File> responseInfo) {
            mProgressDialog.dismiss();
            MyUtils.installAPK(mContext);
        }

        @Override
        public void onFailure(HttpException e, String s) {
            mProgressDialog.setMessage("下載失敗");
            mProgressDialog.dismiss();
            enterHome();
        }

        @Override
        public void onLoading(long total, long current, boolean isUploading) {
            mProgressDialog.setMax((int) total);
            mProgressDialog.setMessage("正在下載...");
            mProgressDialog.setProgress((int) current);
        }
    });
}
 
開發者ID:sh2zqp,項目名稱:MobilePhoneSafeProtector,代碼行數:29,代碼來源:VersionUpdateUtils.java

示例11: downAPK

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
/**
 * 下載APK的方法
 * @param url 要下載文件的路徑
 * @param targetFile 下載文件的本地路徑
 * @param myCallBack 一個接口對象用於監聽文件下載的狀態
 */

public void downAPK(String url, String targetFile, final MyCallBack myCallBack) {
    //創建HttpUtils對象
    HttpUtils httpUtils = new HttpUtils();
    //調用HttpUtils的下載方法下載指定文件
    httpUtils.download(url, targetFile, new RequestCallBack<File>() {
        @Override
        public void onSuccess(ResponseInfo<File> responseInfo) {
            myCallBack.onSuccess(responseInfo);
        }

        @Override
        public void onFailure(HttpException e, String s) {
            myCallBack.onFailure(e,s);
        }

        @Override
        public void onLoading(long total, long current, boolean isUploading) {
            super.onLoading(total, current, isUploading);
            myCallBack.onLoading(total,current,isUploading);
        }
    });
}
 
開發者ID:sh2zqp,項目名稱:MobilePhoneSafeProtector,代碼行數:30,代碼來源:DownLoadUtils.java

示例12: getDataFromServer

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
private void getDataFromServer() {

        HttpUtils utils = new HttpUtils();
        utils.send(HttpRequest.HttpMethod.GET, Constants.TOP_STORIES_URL, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {

                String result = responseInfo.result;

                processResult(result);

                PrefUtils.putString(mActivity, Constants.TOP_STORIES_URL, result);
            }

            @Override
            public void onFailure(HttpException e, String s) {

            }
        });
    }
 
開發者ID:AlarmZeng,項目名稱:zhishi,代碼行數:21,代碼來源:MainNewsFragment.java

示例13: getNewsDateFromServer

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
private void getNewsDateFromServer(String itemId) {

        final String url = Constants.MENU_NEWS_URL + itemId;

        HttpUtils utils = new HttpUtils();
        utils.send(HttpRequest.HttpMethod.GET, url, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {
                String result = responseInfo.result;
                PrefUtils.putString(mActivity, url, result);
                processResult(result);
            }

            @Override
            public void onFailure(HttpException e, String s) {
                Toast.makeText(mActivity, "網絡發生錯誤", Toast.LENGTH_SHORT).show();
            }
        });
    }
 
開發者ID:AlarmZeng,項目名稱:zhishi,代碼行數:20,代碼來源:NewsFragment.java

示例14: getDataFromServer

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
private void getDataFromServer() {

        HttpUtils utils = new HttpUtils();
        utils.send(HttpRequest.HttpMethod.GET, Constants.SPLASH_URL, new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {

                String result = responseInfo.result;

                PrefUtils.putString(SplashActivity.this, Constants.SPLASH_URL, result);
            }

            @Override
            public void onFailure(HttpException e, String s) {

                Toast.makeText(SplashActivity.this, "發生錯誤", Toast.LENGTH_SHORT).show();

                Intent mainIntent = new Intent(SplashActivity.this, MainActivity.class);
                startActivity(mainIntent);
                finish();
                overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left);
            }
        });
    }
 
開發者ID:AlarmZeng,項目名稱:zhishi,代碼行數:25,代碼來源:SplashActivity.java

示例15: get

import com.lidroid.xutils.http.ResponseInfo; //導入依賴的package包/類
/**
	 * get請求數據
	 * @param view
	 */
	@OnClick(R.id.get)
	public void get(View view) {
		String url = "http://www.weather.com.cn/data/cityinfo/101010100.html";
		RequestParams params = new RequestParams();
/*		//添加請求參數
		params.addBodyParameter(key, value);*/
		
/*		//添加請求頭
		params.addHeader(name, value);*/
		http.send(HttpMethod.GET, url, params, new RequestCallBack<String>() {

			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				data.setText(responseInfo.result);
			}

			@Override
			public void onFailure(HttpException error, String msg) {
				Toast.makeText(getActivity(), "訪問失敗" + msg, Toast.LENGTH_SHORT).show();
			}
			
		});
	}
 
開發者ID:xulailing,項目名稱:android-open-project-demo-master,代碼行數:28,代碼來源:HttpFragment.java


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