顯示具有 Android 標籤的文章。 顯示所有文章
顯示具有 Android 標籤的文章。 顯示所有文章

2010年8月22日 星期日

android findViewById()

findViewById() 這個函式

"Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle)."

也就是只能抓到一開始在onCreate(Bundle)函式中設定的 xml layout

EditText str1=(EditText)textEntryView.findViewById(R.id.username_edit);
EditText str2=(EditText)textEntryView.findViewById(R.id.password_edit); 
String m_username=str1.getText().toString(); 
String m_password=str2.getText().toString();