public <T> void addToRequestQueue(Request<T> req, String tag) {
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
Bu ikinci satırda ne yapılır? Bunun ne olduğunu anlayamıyorum (tag)? TAG: tag. İşte İkinci satırda neler yapıldığını anlamak için yardıma ihtiyacınız var mı?
tam kod burada{
import android.app.Application;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
public class AppController extends Application {
public static final String TAG = AppController.class.getSimpleName();
private RequestQueue mRequestQueue;
private static AppController mInstance;
@Override
public void onCreate() {
super.onCreate();
mInstance = this;
}
public static synchronized AppController getInstance() {
return mInstance;
}
public RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(getApplicationContext());
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req, String tag) {
req.setTag(TextUtils.isEmpty(tag) ? TAG : tag);
getRequestQueue().add(req);
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
public void cancelPendingRequests(Object tag) {
if (mRequestQueue != null) {
mRequestQueue.cancelAll(tag);
}
}
}
olduğunu tam kod artık o bu yöntem, ikinci satırda yapılır ne olursa
nereden bileceğiz? Bu senin kodun. Sınıf İsteklerinin bazı örnek değişkenlerine benziyor. Eğer yeterince genel ise lütfen tam bağlamı sağlayın. –
?: Operatörün nasıl çalıştığını mı soruyorsunuz? –
evet operatörün nasıl çalıştığını ve bu yöntemin ikinci satırının kodunun ne yaptığını –