java - Retrofit response after activity finish -


after user logged in successfully, there api call user information. before response close activity , start home activity.

public void onresponse(call<loginresponse> call, response<loginresponse> response) {     //save token      // call rest service user info , update user records on db.     // update notification token info      //go home page     intent intent = new intent(signinactivity.this, homeactivity.class);     startactivity(intent);     finish(); } 

how can make call rest calls outside activity. app can handle onreponse after close activity.

in general how can call api background activity (eg: update database.) without interaction . (response doesn't depend on activity)

the easiest solution use static method. can call methods anywhere.

if want update ui elements inside method, pass ui elements parameters static method.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -