I use this code for reading a tag by a specific URL:
public static String ter(final String PRIVATE) {
JsonParser parser = new JsonParser();
try {
Object obj = parser.parse(new FileReader("my url string"));
JSONObject jsonObject = (JSONObject) obj;
String event = (String) jsonObject.get("EVENT");
return event;
} catch (Exception e) {
e.printStackTrace();
}
return PRIVATE;
}
Then I set my subTitle with PRIVATE in this way:
getActionBar().setSubtitle("test"+ter(PRIVATE));
But when I run my app, in subTitle I read only text "test" with text "null" and it doesn't read the tag of JSON. Anyone has any idea? Is my code wrong?