Code example for HttpPost

Methods: setEntity, setHeader

0
            List<NameValuePair> form = new ArrayList<NameValuePair>();
            for (String key : bundle.keySet()) {
                form.add(new BasicNameValuePair(key, bundle.getString(key)));
            } 
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, "UTF-8");
            return entity;
        } catch (UnsupportedEncodingException e) {
            throw new WeiboException(e);
        } 
    } 
 
    /** 
     * Implement a weibo http request and return results . 
     *  
     * @param context 
     *            : context of activity 
     * @param url 
     *            : request url of open api 
     * @param method 
     *            : HTTP METHOD.GET, POST, DELETE 
     * @param params 
     *            : Http params , query or postparameters 
     * @param Token 
     *            : oauth token or accesstoken 
     * @return UrlEncodedFormEntity: encoed entity 
     */ 
 
    public static String openUrl(Context context, String url, String method,
            WeiboParameters params, Token token) throws WeiboException {
        String rlt = "";