Im using this code on this question :
public void getString(final VolleyCallback callback) {
StringRequest strReq = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
result=response;
callback.onSuccess(result);
}
}...
}}
public interface VolleyCallback{
void onSuccess(String result);
}
my question is why this interface can be use to listening the response. as i know in java interface is some kind of contract and or some abstract class that has some method. Interface need to be implement before we actually use it but in those code above there are not any implement code....
but the new object based on that interface can be populate as listener. need some concise explanation why this concept happen.
thanks for any explanation.