Java Code Examples for org.xutils.http.RequestParams#addQueryStringParameter()

The following examples show how to use org.xutils.http.RequestParams#addQueryStringParameter() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EthBlockExplorer.java    From BlockExplorer with Apache License 2.0 6 votes vote down vote up
@Override
public void getTransactionsByAddress(String address, int page, BlockCallback callback) {
    String url = "http://api.etherscan.io/api";// 分页加载
    RequestParams params = new RequestParams(url);
    params.addQueryStringParameter("module", "account");
    params.addQueryStringParameter("action", "txlist");
    params.addQueryStringParameter("address", address);
    params.addQueryStringParameter("startblock", "0");
    params.addQueryStringParameter("endblock", "99999999");
    params.addQueryStringParameter("page", String.valueOf(page));
    params.addQueryStringParameter("offset", "10");//每页十条信息
    params.addQueryStringParameter("sort", "asc");
    params.addQueryStringParameter("apikey", "YourApiKeyToken");
    LogUtil.e("ETH Url =" + params.getUri());
    get(params, callback);
}
 
Example 2
Source File: BtcBlockExplorer.java    From BlockExplorer with Apache License 2.0 5 votes vote down vote up
@Override
public void getTransactionCount(String address, BlockCallback callback) {
    //可以直接用 getTransactionsByAddress 接口返回参数中有交易总数
    RequestParams params = new RequestParams(URL+BtcConf.GET_TXS.replace("{address}", address));
    params.addQueryStringParameter("from", "0");//默认每次取10条
    params.addQueryStringParameter("to", "1");
    params.addQueryStringParameter("noAsm", "1");
    params.addQueryStringParameter("noScriptSig", "1");
    params.addQueryStringParameter("noSpent", "1");
    get(params, callback);
}
 
Example 3
Source File: BtcBlockExplorer.java    From BlockExplorer with Apache License 2.0 5 votes vote down vote up
@Override
public void getTransactionsByAddress(String address, int page, BlockCallback callback) {
    RequestParams params = new RequestParams(URL+BtcConf.GET_TXS.replace("{address}", address));
    int from = page * 10;
    int to = from + 10;//TODO:test
    params.addQueryStringParameter("from", String.valueOf(from));//默认每次取10条
    params.addQueryStringParameter("to", String.valueOf(to));
    params.addQueryStringParameter("noAsm", "1");
    params.addQueryStringParameter("noScriptSig", "1");
    params.addQueryStringParameter("noSpent", "1");
    LogUtil.e("BTC Url =" + params.getUri());
    get(params, callback);
}
 
Example 4
Source File: XUtil3HttpUtil.java    From AndroidStudyDemo with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 发送get请求
 * @param <T>
 */
public static <T> Cancelable Get(String url,Map<String,String> map,CommonCallback<T> callback){
	RequestParams params=new RequestParams(url);
	if(null!=map){
		for(Map.Entry<String, String> entry : map.entrySet()){
			params.addQueryStringParameter(entry.getKey(), entry.getValue());
		}
	}
	Cancelable cancelable = x.http().get(params, callback);
	return cancelable;
}