Android Json tag into String -
i use code reading tag 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 set subtitle private in way:
getactionbar().setsubtitle("test"+ter(private));
but when run app, in subtitle read text "test" text "null" , doesn't read tag of json. has idea? code wrong?
because may have not initializes variable therefore pointing towards null values....
when ever create object,either calling method or initializing variable @ declaration, can avoid null pointer exception...
please refer post
Comments
Post a Comment