private static void registerAndLogin(String twId, String nickname, String name, String surname, Action <NetmeraUser, Exception> callback) { NetmeraUser user = new NetmeraUser(); RequestItem loginTwUserUserReqItem = new RequestItem(); loginTwUserUserReqItem.setTwId(twId); loginTwUserUserReqItem.setNickname(nickname); loginTwUserUserReqItem.setName(name); loginTwUserUserReqItem.setSurname(surname); NetmeraUser.twitterRegister(loginTwUserUserReqItem, (json, ex) => { if (json == null || ex != null) { if (callback != null) { callback(null, ex); } } else { try { user = NetmeraUser.setCurrentUser(json); if (callback != null) { callback(user, ex); } } catch (NetmeraException e) { if (callback != null) { callback(null, e); } } } }); }