如何将ActivityProfile
传递给Set
类(超类)?
通知:
集合类中的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 {
//...
}
答案 0 :(得分:0)
您可以通过super.
修饰符访问父类的变量或调用函数
就像:在Set
类中,声明一个类似private ActivityProfile profile
的变量。
在ActivityProfile
类中,如果要分配super.profile = this