我有一个类DataGridView这是构造函数
//this class is created in the MainActivity
public DataGridView(Context CTX,TableLayout Tl,int[] Weight) {
this.CTX = CTX;
this.Tl = Tl;
this.Weight= Weight;
}
我想添加一个接收类(什么类)的参数,例如MainActivity
public DataGridView(Context CTX,TableLayout Tl,int[] Weight,Class MA) {
this.CTX = CTX;
this.Tl = Tl;
this.Weight= Weight;
//HERE
this.MA = MA;
}
在The MainActivity中执行此操作
public void Create(){
int[] weight = new int[2];
weight[0] = 1;
weight[1] = 3;
Dr= new DataGridView(CTX,Dt,weight,this);
String[] Columnas = new String[2];
Columnas[0] = "ID";
Columnas[1] = "MATERIA";
Dr.ColumnsAdd(Columnas);
}
我不想放入参数MainActivity MA,因为我会向此对象发送另一个活动。我希望得到Dinamically。