请帮助。我是Android TABS的新手。我希望我的按钮在点击时将我带到一个新页面。目前我正在尝试实现与以前相同的方法。
public class PhotosActivity extends Activity {
private Button btnRegularRecrutor;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.photos_layout);
btnRegularRecrutor = (Button) findViewById(R.id.RegularRecruters);
btnRegularRecrutor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent A = new Intent(MainActivity.this, RegularRecruters.class);
startActivity(A);
}
});
}
}
按钮应该带我去RegularRecruters.class。提前致谢
答案 0 :(得分:0)
变化:
Intent A = new Intent(MainActivity.this, RegularRecruters.class);
成:
Intent A = new Intent(PhotosActivity.this, RegularRecruters.class);
如果您想在标签之间切换:
TabActivity main = (TabActivity) getParent(); // get the main 'TabActivity' from a Child (tab)
TabHost tabHost = main.getTabHost(); // get a handle to the TabHost
tabHost.setCurrentTab(<index>)