【发布时间】:2012-03-27 12:35:15
【问题描述】:
这是我在设计应用程序结构时没有预见到的问题。
基本上我有 3 个班级。
ProfileActivity //The main activity for the application.
ProfileView //Which extends Linear Layout so that I can tinker with my own view. Note that this is just part of the whole activity and not the main layout
ProfileData //This is just a class for storing data.
活动包含多个 ProfileView,每个 ProfileView 包含一个 profileData。
这是我卡住的地方。我的个人资料视图分配了一个单击方法,该方法需要在活动中调用填充方法。不幸的是````
//I'm inside the activity
public void populateProfileDataForm(ProfileData pd)
{
//edit some text fields and other widgets from here
}
有没有办法从 profileView 类中调用活动方法?
如果不是,那么错误出在我的设计中,任何人都可以为我指出一个更好的绑定数据、视图和活动的解决方案吗?
【问题讨论】:
标签: android view android-activity hierarchy