【发布时间】:2011-03-22 09:41:57
【问题描述】:
我想在 Android 上制作一个关于 Twitter 的程序。
代码是这样的:
public class ShareGenerator extends Activity {
private final static String JTWITTER_OAUTH_KEY = "********";
private final static String JTWITTER_OAUTH_SECRET ="***********"
Button menupopButton;
TextView txShare;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.share);
this.setContentView(R.layout.share);
this.txShare = (TextView) this.findViewById(R.id.lblshare);
this.menupopButton = (Button) this.findViewById(R.id.menupop);
menupopButton.setText("login");
menupopButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v)
{
OAuthSignpostClient client = new OAuthSignpostClient(JTWITTER_OAUTH_KEY, JTWITTER_OAUTH_SECRET, "oob");
URI url = client.authorizeUrl();
client.setAuthorizationCode("pin");
String[] accessToken = client.getAccessToken();
Twitter jtwit = new Twitter("cnitwoker", client);
jtwit.setStatus("Messing about in Java");
}
});
}
代码取自示例,但可能有问题。什么是“oob”?如何获得密码?
我收到以下错误:
:03-22 17:24:21.087: ERROR/AndroidRuntime(30260): winterwell.jtwitter.TwitterException: oauth.signpost.exception.OAuthCommunicationException: Communication with the service provider failed: The operation timed out.....
【问题讨论】: