vendredi 21 septembre 2018

Java reflection android

i want to return a list with all public methods of a android resource, as methodname + argumets, for example open(int cameraId), release(), setDisplayOrientation(int degrees) and so on for the camera. So i created this method

public List<String> getPublicMethods(String api) throws ClassNotFoundException {

    Class clazz = Class.forName("android.hardware.Camera");
    Method[] publicMethods= clazz.getDeclaredMethods();


    List<String> list=new ArrayList<>();

    for (Method met : publicMethods) 
        list.add(met.getName()); 
    return list;
}

I can return only a list. How do i change it so it returns the arguments too?





Aucun commentaire:

Enregistrer un commentaire