Android > À̺¥Æ® ¹ß»ý½Ã ActivityÀÇ ÇÔ¼ö È£Ãâ¹æ¹ý.
µî·ÏÀÏ : 2017-07-05 10:57
Á¶È¸¼ö : 53,221
Main1.class ÆÄÀÏ ¾È¿¡ steupTabs() , moveTabs() ÇÔ¼ö°¡ Á¸Àç ÇÕ´Ï´Ù.
Sub3.class ÆÄÀÏ¿¡¼ Main1.class ¿¡ ÀÖ´Â ÇÔ¼ö¸¦ È£ÃâÇÏ°í ½Í½À´Ï´Ù. ¾î¶»°Ô ÇØ¾ß ÇÒ±î¿ä?
Main1.java ÆÄÀϳ»¿ë
public class Main1 extends TabActivity {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main1);
setupTabs();
moveTabs(0);
}
public void setupTabs()
{
...Áß·«
}
public void moveTabs(int num)
{
...Áß·«
}
}
Sub03.java ÆÄÀÏ ³»¿ë
public class Sub03 extends Activity {
Main1 main1 = new Main1();
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sub03);
Button button01 = (Button) findViewById(R.id.button01);
button01.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Toast.makeText(getApplicationContext(),"ÈïÁ¤³»¿ªÀ¸·Î °©´Ï´Ù.",500).show();
main1.moveTabs(1);
}
});
}