嗨,我正在从 twitter 获取朋友列表,现在我想向从列表中选择的特定用户发送推文。任何代码片段将不胜感激。这是我要NullPointerException
上车了twitter.sendmessage("id of user","msg")
private void tweet(){
setTitle("Tweet");
AlertDialog.Builder inputDialog;
inputDialog = new AlertDialog.Builder(MainActivity.this);
inputDialog.setTitle("Enter Tweet");
et_input = new EditText(MainActivity.this);
et_input.setWidth(250);
et_input.setHeight(30);
inputDialog.setView(et_input);
inputDialog.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
txt_tweet= et_input.getText().toString();
System.out.println("String what i have type "+txt_tweet);
try{
twitter.sendMessage("testsynapse1", txt_tweet);
Toast.makeText(MainActivity.this,
"Tweet Successful", Toast.LENGTH_LONG).show();
}
catch (TwitterException e) {
// TODO: handle exception
e.getMessage();
}
}
});
inputDialog.setNegativeButton("Cancle",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
inputDialog.show();
}