在android中,我不太確定我是否理解R
類。我經歷的數獨例子,我有這樣的代碼片段:瞭解Android中的R類
switch (v.getId()) // the id of the argument passed is evaluated by switch statement
{
case R.id.about_button: //
Intent i = new Intent(this, about.class);
startActivity(i);
break;
// More buttons go here (if any) ...
}
我全新到Java,但是從我收集它看起來像它採取輸入(觸摸屏被觸及按鈕)並評估參數。然後,如果關於按鈕被識別,則設置案例陳述,並且創建新的界面屏幕,然後導航到電話上。
這是正確的嗎?
如果我認爲正確的主旨,爲什麼與「R」類交易?
爲什麼它被稱爲識別按鈕的ID?
我以爲超類(在這個項目中)是SudokuActivity類。
[Android:什麼是R?爲什麼它是如此神祕?](http://stackoverflow.com/questions/4953077/android-what-is-r-why-is-it-so-cryptic) – nbro