任何人都可以告訴我我的代碼有什麼問題嗎?一個Java文件中的兩個下一個函數
我有兩個按鈕的頁面。 當我按下名爲「索引」的第一個按鈕時,我進入了正確的頁面。 當我按下名爲「annonce」的第二個按鈕時,我也會進入同一頁面,就好像我按了「索引」一樣。
這裏是我的代碼:
public class zzzzMarket extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv=(TextView)findViewById(R.id.Sign);
Typeface face=Typeface.createFromAsset(getAssets(), "fonts/HandmadeTypewriter.ttf");
tv.setTypeface(face);
};
public void NextFunction(View v) {
Intent i = new Intent(this, index.class);
startActivity(i);
};
public void NextFunction1(View v) {
Intent j = new Intent(this, annonce.class);
startActivity(j);
}
}
嗨,你在哪裏註冊功能的按鈕? – MByD 2012-03-16 16:07:53
嗨THX但什麼杜U的意思是。我是Android的初學者。 – wadood 2012-03-16 16:09:51
他問你如何將你的按鈕鏈接到Java代碼中的方法 - 我的猜測是你在main.xml佈局中使用onClick =「NextFunction」在兩個按鈕上執行 – Guillaume 2012-03-16 16:16:01