Created
May 9, 2020 15:32
-
-
Save liusilong/a66010df2c45063fa32737a510e4a86e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.lsl.flutterplugin17; | |
import android.util.Log; | |
import java.lang.reflect.Method; | |
/** | |
* Created by liusilong on 2020/5/9. | |
* version:1.0 | |
* Describe: | |
*/ | |
public class Person { | |
private static final String TAG = "Person"; | |
// This method will be called by reflection | |
public void personName() { | |
Log.e(TAG, "personName: call personName method...."); | |
} | |
public void execute(String methodName) { | |
try { | |
Method method = Person.class.getDeclaredMethod(methodName); | |
method.invoke(Person.this); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment