I have a class where I receive an event - a boolean variable in this case, using EventBus/Otto(for Fragment/Activity or something similar for posibility to subscribe in simple class) like:
@Subscribe
public void onSubscribeMyData(boolean myData) {
if(myData){
Log.d("LOG_TAG", "my received string is true");
}
else{
Log.d("LOG_TAG", "my received string is false");
}
}
UPDATE My class contains only this method:
//check network
public boolean isNetworkAvailable(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
String ip = "217.26.147.42";
AsyncTaskIsOnline taskIsOnline = new AsyncTaskIsOnline();
taskIsOnline.execute(ip);
return networkInfo != null && networkInfo.isConnectedOrConnecting() && myReceivedVariable;
}
so, how can I asign received myData to myReceivedVariable but this class is instantiated evrey time when i make server call
I tried to asign value to global variables or wrap this boolean in a object and use set/get but no success...