D
D
Denis2016-08-06 21:20:03
Android
Denis, 2016-08-06 21:20:03

How to change current activity from Application?

Is it possible somehow from Application (meaning its self-written successor) to change the current activity and delete the entire history so that it would be impossible to return to previous activities?
Let me explain in more detail:
I now have a global class in Application, with access to Application, which is responsible for working with the network. This class has a user authorization check, and if the check fails, then I need to complete all windows and throw the user out on the authorization page.
Please tell me how to do it :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rou1997, 2016-08-06
@lacredin

Activity can be launched not only from Activity, but also from any Context class, including Application:

Intent ii = new Intent(this, TargetActivity.class);
this.startActivity(ii);

clear top.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question