Remove Twitter Status - Java Social Media

Java examples for Social Media:Twitter

Description

Remove Twitter Status

Demo Code



import twitter4j.*;
import twitter4j.auth.AccessToken;


public class Test {
    private static String consumerKey = "key";
    private static String consumerSecret = "key";
    private static String accessToken = "token";
    private static String accessTokenSecret = "token";

    public static void main(String[] args) throws InterruptedException {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.setOAuthConsumer(consumerKey, consumerSecret);
        twitter.setOAuthAccessToken(new AccessToken(accessToken,
                accessTokenSecret));/*from w  ww.  java2s. c o  m*/

        String text = "asdf";
        try {

            Status status = twitter.updateStatus(text);

            System.out.println(+ status.getText());

            Thread.currentThread().sleep(10000);

            twitter.destroyStatus(status.getId());

        } catch (TwitterException e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }
}

Related Tutorials