Raising (Something Like) a Tweet
import org.json.JSONObject;
public class Patchy extends Activity {
private DefaultHttpClient client=null;
private EditText user=null;
private EditText password=null;
private EditText status=null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
user=(EditText)findViewById(R.id.user);
password=(EditText)findViewById(R.id.password);
status=(EditText)findViewById(R.id.status);
Button send=(Button)findViewById(R.id.send);
send.setOnClickListener(onSend);
client=new DefaultHttpClient();
}
@Override
public void onDestroy() {
super.onDestroy();
client.getConnectionManager().shutdown();
}
private String getCredentials() {
String u=user.getText().toString();
String p=password.getText().toString();
return(Base64.encodeBytes((u+":"+p).getBytes()));
}
private void updateStatus() {
try {
String s=status.getText().toString();
HttpPost post=new HttpPost("https://identi.ca/api/statuses/update.json");
post.addHeader("Authorization",
"Basic "+getCredentials());
List
form.add(new BasicNameValuePair("status", s));
post.setEntity(new UrlEncodedFormEntity(form, HTTP.UTF_8));
ResponseHandler