1
我想要在活動中的片段中的我的按鈕「configbutton」的id,以便我可以調用活動中聲明的某些方法。但我無法這樣做。 有沒有辦法做到這一點。 Activity類嘗試引用活動中的片段按鈕
public class UartLoopBackActivity extends FragmentActivity implements
ActionBar.TabListener {
Button configButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.data_analysis);
configButton = (Button) findViewById(R.id.configButton);
}
片段類
3210如果有什麼辦法你知道PLZ共享代碼。 我想要引用活動類中片段中的按鈕,以便可以從活動類調用該按鈕的偵聽器。這是可能的。 thanku
可能重複http://stackoverflow.com/questions/12659747/call-an-activity-method-from-a-fragment – 2014-09-21 13:21:07