how to return value from onSuccess to other function in android?

0 votes
public String getSessionID(String user) {
    String userName = user;
    SessionService sessionService = App42API.buildSessionManager();
    sessionService.getSession(userName,new App42CallBack() {
        public void onSuccess(final Object response)
            Session session = (Session)response;
            s_id = session.getSessionId();
        public void onException(Exception ex)
            System.out.println("Exception Message"+ex.getMessage());
    return s_id;
asked Jan 28 in Announce Your App by AH Forootan (10 points)

1 Answer

0 votes

All the App42 APIs are async so you can not return any value from the callback onSuccess to its calling method. The best way is to write a separate method to perform a task which depends on the value you get in the onSuccess callback. Once you have that value, you call that method from the callback and pass the values as parameter.

I hope this will help.

answered Jan 29 by rajeev.etc (1,508 points)
I can't write this separate method , can you send a example for me ?
I tried any way but , I can't do it ... but I need it.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on
Migrate from Parse to ShepHertz App42