Android:从另一个活动在活动中创建tablerow
我有两项活动 活动1和活动2Android:从另一个活动在活动中创建tablerow,android,android-intent,Android,Android Intent,我有两项活动 活动1和活动2 private TableRow createRow(int y){ TableRow row = new TableRow(Activity2.context); <---- this one? row.setHorizontalGravity(Gravity.CENTER); for (int x = 0; x < COL_COUNT; x++) { row.addView(createImageButton
private TableRow createRow(int y){
TableRow row = new TableRow(Activity2.context); <---- this one?
row.setHorizontalGravity(Gravity.CENTER);
for (int x = 0; x < COL_COUNT; x++) {
row.addView(createImageButton(x,y));
}
return row;
}
我正在尝试从活动1创建一个表,我正在尝试在活动2中创建它
private TableRow createRow(int y){
TableRow row = new TableRow(Activity2.context); <---- this one?
row.setHorizontalGravity(Gravity.CENTER);
for (int x = 0; x < COL_COUNT; x++) {
row.addView(createImageButton(x,y));
}
return row;
}
private TableRow createRow(int y){
TableRow row=new TableRow(Activity2.context);为什么要这样做?每个活动都有自己的UI。您应该填充启动Activity2的Intent
,然后让Activity2
的onCreate()
构建UI。