Why declare buttons in onCreate() in MainActivity.java?
问题 I'm a noob in writing Android app. The below 2 examples about declaring buttons are all from the Android developer site. (So both of them should be correct and working.) Example 1: from http://developer.android.com/training/basics/firstapp/building-ui.html <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" android:onClick="sendMessage" /> Example 2: from http://developer.android.com/guide/topics/ui/declaring-layout.html