tags:

views:

109

answers:

3

Can anyone tel me how to tweet using Android? How can i send tweets using Android?

+2  A: 

Check the API available at http://apiwiki.twitter.com/

There is a list of FAQs and examples available there.

Sam
+1  A: 

You want something like this:

    mHttpClient = new DefaultHttpClient();
    mCredentials = new UsernamePasswordCredentials("username", "password");
    mHttpClient.getCredentialsProvider().setCredentials(
        new AuthScope("twitter.com", 80, "Twitter API"),
        mCredentials);

    HttpPost post = new HttpPost("http://twitter.com/statuses/update.xml");
    HttpParams params = post.getParams();
    HttpClientParams.setCookiePolicy(params, CookiePolicy.BROWSER_COMPATIBILITY);
    HttpProtocolParams.setUseExpectContinue(params, false);

    post.setParams(params);
    ArrayList<NameValuePair> form =  new ArrayList<NameValuePair>();
    form.add(new BasicNameValuePair("status", "I'm tweeting!"));
    UrlEncodedFormEntity ent = new UrlEncodedFormEntity(form);
    post.setEntity(ent);
    HttpResponse resp = mHttpClient.execute(post);

(Ripped from my own code, and stripped down a little bit for brevity. It won't compile as-is!)

Dave
Hi....Can u tel me where to insert this code?
Saranya.R
That's for you to work out!
Dave
A: 

Here's an example of how to develop a twitter client for android.

If you just want to send tweets from Android and not necessarily from your application you could try andtweet.

primalpop