将twitter与android集成的问题

时间:2011-07-04 13:57:19

标签: android twitter

我想将twitter集成到我的Android应用程序中,因为我提到了link

我已将代码用于我的主要活动`Twew my_twiter;

Button btn_login;
EditText edit_user_name;
EditText edit_password;

@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    btn_login = (Button) findViewById(R.id.main_loin_button);
    edit_user_name = (EditText) findViewById(R.id.main_username_edit_text);
    edit_password = (EditText) findViewById(R.id.main_password_edit_text);

    btn_login.setOnClickListener(this); 
}

@SuppressWarnings("deprecation")
@Override
public void onClick(View v) 
{
    String userName = edit_user_name.getText().toString();
    String password = edit_password.getText().toString();
    my_twiter = new Twitter(userName,password);
    if(my_twiter == null)
    {
     Toast.makeText(TwitActivty.this, "Incorrect Login",Toast.LENGTH_LONG).show();
    }
    else 
    {
//          Toast.makeText(TwitActivty.this, "Worked",Toast.LENGTH_LONG).show();
        try
        {
         Log.i("Twitter Status :",my_twiter.getStatus()+"");
         Intent intent = new Intent(TwitActivty.this,Twitter_Info_Activity.class);
         startActivity(intent);
        }
        catch(Exception e)
        {
           e.printStackTrace();
        }
        }
    }`

但我得到了例外

>

  

07-04 13:47:37.224:WARN / System.err(840):winterwell.jtwitter.TwitterException $ E401:未经授权   07-04 13:47:37.224:WARN / System.err(840):http://api.twitter.com/1/statuses/user_timeline.json?count=6&()   07-04 13:47:37.233:WARN / System.err(840):at winterwell.jtwitter.URLConnectionHttpClient.processError(URLConnectionHttpClient.java:364)   07-04 13:47:37.233:WARN / System.err(840):at winterwell.jtwitter.URLConnectionHttpClient.connect(URLConnectionHttpClient.java:198)   07-04 13:47:37.233:WARN / System.err(840):at winterwell.jtwitter.URLConnectionHttpClient.getPage(URLConnectionHttpClient.java:239)   07-04 13:47:37.243:WARN / System.err(840):at winterwell.jtwitter.Twitter.getStatus(Twitter.java:2244)   07-04 13:47:37.243:WARN / System.err(840):at com.twit.TwitActivty.onClick(TwitActivty.java:51)   07-04 13:47:37.243:WARN / System.err(840):在android.view.View.performClick(View.java:2408)   07-04 13:47:37.253:WARN / System.err(840):在android.view.View $ PerformClick.run(View.java:8816)   07-04 13:47:37.253:WARN / System.err(840):在android.os.Handler.handleCallback(Handler.java:587)   07-04 13:47:37.263:WARN / System.err(840):在android.os.Handler.dispatchMessage(Handler.java:92)   07-04 13:47:37.263:WARN / System.err(840):在android.os.Looper.loop(Looper.java:123)   07-04 13:47:37.263:WARN / System.err(840):在android.app.ActivityThread.main(ActivityThread.java:4627)   07-04 13:47:37.273:WARN / System.err(840):at java.lang.reflect.Method.invokeNative(Native Method)   07-04 13:47:37.273:WARN / System.err(840):at java.lang.reflect.Method.invoke(Method.java:521)   07-04 13:47:37.293:WARN / System.err(840):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)   07-04 13:47:37.303:WARN / System.err(840):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)   07-04 13:47:37.303:WARN / System.err(840):at dalvik.system.NativeStart.main(Native Method)

我没有得到我错的地方或告诉我更好的替代方式与twitter集成请帮助我

0 个答案:

没有答案