samedi 2 juillet 2016

Understanding an if-statement variation [duplicate]

This question already has an answer here:

I am new to StackOverflow and the coding scene, I am in my 2nd year of University and currently learning Android development - I want to make a simple login and reregistration screen. I found this tutorial online. I got the application to run now I am just reading and understanding the code. However, I do not fully understand what this line does inside AppController.java:

public <T> void addToRequestQueue(Request<T> req, String tag) {
    req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
    getRequestQueue().add(req);
}

I did a StackOverflow search and found this where it states the following answer:

if(tag.isEmpty()){
  res.setTag(TAG)

} else {
  res.setTag(tag)

}

However, I do not understand what he means by the variable res. Does he mean req instead? Because I cant find a res variable. Also 1 more question I want to use an Android snackbar in my application, but I cant seem to find the minimum API level for it, what is the minimum API level to use snackbar? thanks

Aucun commentaire:

Enregistrer un commentaire