2014-03-03 40 views
0

我建立一个Twitter客户端,当它打开它强行关闭和logat显示的OnCreate异常()方法,构造推特(字符串,字符串)已被弃用

这里有什么问题

public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    // find views by id 
    buttonUpdate = (Button) findViewById(R.id.buttonUpdate); 
    textStatus = (EditText) findViewById(R.id.textStatus); 

    // Add listener 
    buttonUpdate.setOnClickListener(this); 

    //Initialize twitter 
    prefs = PreferenceManager.getDefaultSharedPreferences(this); 
    String username = prefs.getString("username", "n/a"); 
    String password = prefs.getString("password", "n/a"); 
    if (username != null && password != null){ 
     twitter = new Twitter(username, password); 
    } 


} 

,我认为它是在这里在这一行

 twitter = new Twitter(username, password); 

它在内衬和表演“的构造推特(字符串,字符串)已被弃用”

这是什么意思?

+0

这意味着它不是现在使用的或可用的一些新的方法相同 – user3283976

回答

0

Twitter不再支持名称/密码基本认证。此构造函数仅适用于非Twitter网站,如identi.ca。

您需要使用下面的方法...

public Twitter(java.lang.String name, 
     Twitter.IHttpClient client) 

你可以找到这种方法的详细文档here

相关问题