本文整理汇总了Java中com.sina.weibo.sdk.net.AsyncWeiboRunner类的典型用法代码示例。如果您正苦于以下问题:Java AsyncWeiboRunner类的具体用法?Java AsyncWeiboRunner怎么用?Java AsyncWeiboRunner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AsyncWeiboRunner类属于com.sina.weibo.sdk.net包,在下文中一共展示了AsyncWeiboRunner类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUserInfo
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
public String[] getUserInfo(String uid) throws WeiboException {
String url = API_SERVER + "/users/show.json";
String res = CacheUtils.getCache(
sContext,
CacheUtils.getKey(CacheUtils.CACHE_USER_INFO, new String[] {
"uid", uid }), 3 * 24 * 60 * 60 * 1000);
if (res != null) {
return new String[] { "true", res };
}
WeiboParameters params = new WeiboParameters(Constants.APP_KEY);
params.put("uid", uid);
params.put("access_token", sAccessToken.getToken());
return new String[] { "false",
new AsyncWeiboRunner(sContext).request(url, params, "GET") };
}
示例2: getWeiboInfo
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
public String[] getWeiboInfo(String weiboId) throws WeiboException {
String url = API_SERVER + "/statuses/show.json";
String res = CacheUtils.getCache(
sContext,
CacheUtils.getKey(CacheUtils.CACHE_WEIBO_INFO, new String[] {
"id", weiboId }), 3 * 24 * 60 * 60 * 1000);
if (res != null) {
return new String[] { "true", res };
}
WeiboParameters params = new WeiboParameters(Constants.APP_KEY);
params.put("id", weiboId);
params.put("access_token", sAccessToken.getToken());
return new String[] { "false",
new AsyncWeiboRunner(sContext).request(url, params, "GET") };
}
示例3: requestAsync
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
/**
* HTTP 异步请求。
*
* @param url 请求的地址
* @param params 请求的参数
* @param httpMethod 请求方法
* @param listener 请求后的回调接口
*/
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
if (null == mAccessToken
|| TextUtils.isEmpty(url)
|| null == params
|| TextUtils.isEmpty(httpMethod)
|| null == listener) {
LogUtil.e(TAG, "Argument error!");
return;
}
params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
示例4: requestSync
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
/**
* HTTP 同步请求。
*
* @param url 请求的地址
* @param params 请求的参数
* @param httpMethod 请求方法
*
* @return 同步请求后,服务器返回的字符串。
*/
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
if (null == mAccessToken
|| TextUtils.isEmpty(url)
|| null == params
|| TextUtils.isEmpty(httpMethod)) {
LogUtil.e(TAG, "Argument error!");
return "";
}
params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
示例5: requestAsync
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
/**
* HTTP 异步请求。
*
* @param url 请求的地址
* @param params 请求的参数
* @param httpMethod 请求方法
* @param listener 请求后的回调接口
*/
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
if (null == mAccessToken
|| TextUtils.isEmpty(url)
|| null == params
|| TextUtils.isEmpty(httpMethod)
|| null == listener) {
LogUtil.e(TAG, "Argument error!");
return;
}
params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
示例6: requestSync
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
/**
* HTTP 同步请求。
*
* @param url 请求的地址
* @param params 请求的参数
* @param httpMethod 请求方法
*
* @return 同步请求后,服务器返回的字符串。
*/
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
if (null == mAccessToken
|| TextUtils.isEmpty(url)
|| null == params
|| TextUtils.isEmpty(httpMethod)) {
LogUtil.e(TAG, "Argument error!");
return "";
}
params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
示例7: requestAsync
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
/**
*/
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
if (null == mAccessToken
|| TextUtils.isEmpty(url)
|| null == params
|| TextUtils.isEmpty(httpMethod)
|| null == listener) {
LogUtil.e(TAG, "Argument error!");
return;
}
params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
new AsyncWeiboRunner(mContext).requestAsync(url, params, httpMethod, listener);
}
示例8: requestSync
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
/**
*/
protected String requestSync(String url, WeiboParameters params, String httpMethod) {
if (null == mAccessToken
|| TextUtils.isEmpty(url)
|| null == params
|| TextUtils.isEmpty(httpMethod)) {
LogUtil.e(TAG, "Argument error!");
return "";
}
params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
return new AsyncWeiboRunner(mContext).request(url, params, httpMethod);
}
示例9: startShare
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
private void startShare() {
LogUtil.d(TAG, "Enter startShare()............");
final ShareRequestParam req = this.mRequestParam;
if (req.hasImage()) {
LogUtil.d(TAG, "loadUrl hasImage............");
new AsyncWeiboRunner(this).requestAsync(ShareRequestParam.UPLOAD_PIC_URL, req.buildUploadPicParam(new WeiboParameters(req.getAppKey())), "POST", new RequestListener() {
public void onWeiboException(WeiboException e) {
LogUtil.d(WeiboSdkBrowser.TAG, "post onWeiboException " + e.getMessage());
req.sendSdkErrorResponse(WeiboSdkBrowser.this, e.getMessage());
WeiboSdkBrowser.this.finish();
}
public void onComplete(String response) {
LogUtil.d(WeiboSdkBrowser.TAG, "post onComplete : " + response);
UploadPicResult result = UploadPicResult.parse(response);
if (result == null || result.getCode() != 1 || TextUtils.isEmpty(result.getPicId())) {
req.sendSdkErrorResponse(WeiboSdkBrowser.this, "upload pic faild");
WeiboSdkBrowser.this.finish();
return;
}
WeiboSdkBrowser.this.openUrl(req.buildUrl(result.getPicId()));
}
});
return;
}
openUrl(this.mUrl);
}
示例10: searchFans
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
public String searchFans(String q, String count) throws WeiboException {
String url = API_SERVER + "/search/suggestions/at_users.json";
WeiboParameters params = new WeiboParameters(Constants.APP_KEY);
params.put("access_token", sAccessToken.getToken());
params.put("q", q);
params.put("count", count);
params.put("type", "3");
return new AsyncWeiboRunner(sContext).request(url, params, "GET");
}
示例11: getAddress
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
public String getAddress(GeoInfo geo) throws WeiboException {
if (geo == null) {
return null;
}
String url = API_SERVER + "/location/geo/geo_to_address.json";
WeiboParameters params = new WeiboParameters(Constants.APP_KEY);
params.put("access_token", sAccessToken.getToken());
params.put("coordinate", geo.longitude + "," + geo.latitude);
return new AsyncWeiboRunner(sContext).request(url, params, "GET");
}
示例12: requestAsync
import com.sina.weibo.sdk.net.AsyncWeiboRunner; //导入依赖的package包/类
/**
* HTTP 异步请求。
*
* @param url 请求的地址
* @param params 请求的参数
* @param httpMethod 请求方法
* @param listener 请求后的回调接口
*/
protected void requestAsync(String url, WeiboParameters params, String httpMethod, RequestListener listener) {
if (null == mAccessToken
|| TextUtils.isEmpty(url)
|| null == params
|| TextUtils.isEmpty(httpMethod)
|| null == listener) {
LogUtil.e(TAG, "Argument error!");
return;
}
params.put(KEY_ACCESS_TOKEN, mAccessToken.getToken());
AsyncWeiboRunner.requestAsync(url, params, httpMethod, listener);
}