vendredi 23 septembre 2016

How to make condition based on flag in android?

I have an app in which I have to check whether internet connection is available or not, and also some conditions: if int flag==0 then only send server request and in server response success set flag=1, now on second run, app will check whether net is available or not and if flag==0 then only send server request if it found flag==1 then do not send server request.How can I make this .

I am trying:-

int flag=0;
if (NetworkUtil.isConnected(this)&& (flag==0)){
        Log.e(s_szTAG,"Connected:");
        //here sending server request an on server success response setting flag=1;
        flag = 1;
        Log.e(s_szTAG,"flag::"+flag);

    }else {
        Log.e(s_szTAG,"No net connection found");

    }

but this code does not work pls help

Aucun commentaire:

Enregistrer un commentaire