如何将 ActivityProfile
传递给 Set
class(超类)?
注意: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 {
//...
}
1 回答
您可以通过
super.
修饰符访问变量或调用超类的函数比如:在
Set
类中,声明一个像这样的变量private ActivityProfile profile
.在
ActivityProfile
类中,super.profile = this
如果要分配它