I'm trying a button using reflection in android, by the following code
public String createView(String classFullName){
try{
Class clazz = Class.forName(classFullName);
Object obj = clazz.newInstance(); // but I need to pass the Context using this;
}
catch(ClassNotFoundException ex){
return null;
}
}
but the main problem, is how to pass Context ( which is this in my case ) to the Object since they all should be a View.
newInstance()on that constructor object. Take a look here: tutorials.jenkov.com/java-reflection/constructors.html