vendredi 29 septembre 2017

How to invoke the method of a fragment that belongs to an activity

With this code I am invoking a method of an activity.

What I require is to invoke a method of a fragment that belongs to an activity.

if (AppCompatActivity.class.equals(ctx.getClass().getSuperclass())) {
    if (callBackName != null) {
        Activity activity = (Activity) ctx;
        Method method = activity.getClass().getMethod(callBackName, parameters);
        method.invoke(activity, response, isError, errorType);
    }
}





Aucun commentaire:

Enregistrer un commentaire