通过Curret活动进入超级班级

时间:2018-12-10 00:14:34

标签: android

如何将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 {
    //...
}

1 个答案:

答案 0 :(得分:0)

您可以通过super.修饰符访问父类的变量或调用函数

就像:在Set类中,声明一个类似private ActivityProfile profile的变量。

ActivityProfile类中,如果要分配super.profile = this