List of usage examples for twitter4j Twitter getBlocksIDs
IDs getBlocksIDs() throws TwitterException;
From source file:com.javielinux.utils.UserActions.java
License:Apache License
public static void goToCreateBlock(Context context, InfoUsers infoUsers) { ConnectionManager.getInstance().open(context); Twitter twitter = ConnectionManager.getInstance() .getTwitter(DBUtils.getIdFromUserName(infoUsers.getName())); try {//from w w w . j av a 2s.c o m boolean isBlock = false; for (long id : twitter.getBlocksIDs().getIDs()) { if (id == infoUsers.getId()) { isBlock = true; break; } } if (true) { twitter.destroyBlock(infoUsers.getName()); Utils.showMessage(context, context.getString(R.string.user_unlock)); } else { twitter.createBlock(infoUsers.getName()); Utils.showMessage(context, context.getString(R.string.user_block)); } } catch (TwitterException e) { e.printStackTrace(); } }
From source file:twitter4j.examples.block.GetBlockingUsersIDs.java
License:Apache License
/** * Usage: java twitter4j.examples.block.GetBlockingUsersIDs * * @param args message/*ww w. ja v a 2 s . com*/ */ public static void main(String[] args) { try { Twitter twitter = new TwitterFactory().getInstance(); IDs ids = twitter.getBlocksIDs(); for (long id : ids.getIDs()) { System.out.println(id); } System.out.println("done."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to get blocking user ids: " + te.getMessage()); System.exit(-1); } }