public static DataType createObject(String className,String value){
  try {
    Class<?> theClass=Class.forName(className);
    Class<?>[] constructorParameters=new Class[1];
    constructorParameters[0]=Class.forName("java.lang.String");
    Constructor<?> classConstructor=theClass.getConstructor(constructorParameters);
    return (DataType)classConstructor.newInstance(value);
  }
 catch (  Exception ex) {
    Log.e("createObject","Can't create class " + className + " with value: "+ value);
  }
  return null;
}

public static DataType createObject ( String className , String value ) { try { Class < ? > theClass = Class . forName ( className ) ; Class < ? > [ ] constructorParameters = new Class [ 1 ] ; constructorParameters [ 0 ] = Class . forName ( "java.lang.String" ) ; Constructor < ? > classConstructor = theClass . getConstructor ( constructorParameters ) ; return ( DataType ) classConstructor . newInstance ( value ) ; } catch ( Exception ex ) { Log . e ( "createObject" , "Can't create class " + className + " with value: " + value ) ; } return null ; }
factory method that creates the object of classname type and initialized with provided value
