There is an online application. It has a lot of activations from which you need to send HTTP requests to the server. For this, a separate class is made - HttpLoader, through which it is convenient to make these same requests. Usage looks like this:
HttpLoader loader = new HttpLoader("http://site.com/script.php"); loader.setOnFinishListener(new HttpLoader.OnFinishListener() { public void onFinish(JSONObject json) { //Обработка данных } }); loader.start(); I would like to show AlertDialog, if you suddenly lost the connection to the network, with two buttons - “Retry” and “Exit application”. The problem is that in this class there is no link to the current Activity. How to implement it?
As I imagine, it is necessary that in each activation there is a code that is directly responsible for displaying this alert, and then some kind of interaction at the listener level with the HttpLoader class. Is this generally the right direction?
mAlert.dismiss();inonDestroy()activate? - Helisia