java:

public class MainActivity extends Activity {


private Button btn_two;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.one);

 findfView() ;

 btn_two.setOnClickListener(new View.OnClickListener() {
            public void onClick(View arg0) {
            
            Intent select_obj = new Intent(getBaseContext(),Tab2.class);
                                                                                  //Tab2 為換到哪一頁的Activity
            MainActivity .this.startActivity(select_obj);
            
            }
        });


}
private void findfView() {
btn_two = (Button) this.findViewById(R.id.btn_two);
}



@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

}

arrow
arrow
    全站熱搜

    小Chiu 發表在 痞客邦 留言(0) 人氣()