I'm really not sure why it's doing this but it seems to be an issue with brackets. I'm getting the following errors while running this segment of code for Android in Eclipse:
private static final String TWITTER_ACCESS_TOKEN_URL = "http://api.twitter.com/oauth/access_token";
private static final String TWITTER_AUTHORZE_URL = "https://api.twitter.com/oauth/authorize";
private static final String TWITTER_REQUEST_URL = "https://api.twitter.com/oauth/request_token";
public static final String itemOfClothing;
public static final String clothingEmotion;
public static final String user;<<<<<<<<<<<<<<<<<<<<< Syntax error on token ";", { expected after this token
itemOfClothing = "pants";
clothingEmotion = "I'm feeling left in the dark";
user = "stuart";
public static String MESSAGE = itemOfClothing +": " + clothingEmotion + "! #" + user + "EmotionalClothing"; <<<<<<<<<<<<<<<<<<<<<< Syntax error, insert "}" to complete Block
public TwitterApp(Activity context, String consumerKey, String secretKey) {
this.context = context;
You should initialize your strings at the point of declaration only, or inside a constructor. You can't have statements at the top-level class. You can just have declarations there.
So, one solution is, change the below statements: -
to: -
Or, another solution is, to move those assignments in a constructor, in which case, you would have to move the
initializationofMESSAGEalso in that constructor.And also, if those variables are supposed to be
constants, which I assume they are, as they arepublic static final, then your should useALL_CAPS_WITH_UNDERSCOREto name them.