我如何将ActivityProfile
传递给Set
类(Superclass)?
注意:集合类中的activity
字段是ActivityProfile
public class Set extends AppCompatActivity {
protected View v_change_profile = null;
protected TextView txtTitle;
private Activity activity ;
public Set(Activity activity) {
this.activity= activity;
LayoutInflater inflater = activity.getLayoutInflater();
v_change_profile = inflater.inflate(R.layout.edit_profile_dialog, null);
txtTitle = v_change_profile.findViewById(R.id.txtTitle);
}
//**************************************************
public class ActivityProfile extends Set {
//...
}
您可以通过super.
修饰符访问变量或调用超类的函数
比如:在Set
类中,声明一个像private ActivityProfile profile
这样的变量。
在ActivityProfile
课程中,super.profile = this
如果你想分配它