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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -