Android Sina Weibo calls user Weibo Interface

Source: Internet
Author: User
Tags oauth

After passing the previous authentication, you can call the open APIs in the API. Generally, the applications we develop need to display Weibo information of some enterprises. For example, the MasterCard I developed previously showed MasterCard Weibo.

First, we need to call an interface: callback
Now Sina has changed to interfaces with S, but it still does not feel that S is easy to use. Many examples on the Internet call interfaces without S, and I call interfaces with S, I don't know the reason. If you know the reason, please tell your younger brother. I also use it here.

Note that:

 

Generally, we query Weibo Based on screen_name settings.

 

Code snippet:

Oauthconsumer authconsumer = new commonshttpoauthconsumer (oauth. consumerkey, oauth. consumersecret); authconsumer. settokenwithsecret (user. token, user. tokensecret); here we can also pass the authconsumer during the previous oauth authentication, so we don't need to use these steps. Client = new defaulthttpclient (); httppost = new httppost (user_timeline_url ); // There are many attributes such as page and count. Check the API. list <namevaluepair> List = new arraylist <namevaluepair> (); list. add (New basicnamevaluepair ("screen_name", "MasterCard"); httppost. setentity (New urlencodedformentity (list, HTTP. utf_8); httppost. getparams (). setbooleanparameter (coreprotocolpnames. use_expect_continue, false); authconsumer. sign (httppost); httpresponse = client.exe cute (httppost); If (httpstatus. SC _ OK = httpresponse. getstatusline (). getstatuscode () {string result = entityutils. tostring (httpresponse. getentity (); log. I (oauth. tag, result );}

 

In this way, we can get the Weibo information we want.

 

Shown as follows: (MasterCard is displayed)

Being developed, it looks ugly. If you don't have time to adjust it, you will be there.

 


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.