Respond to the Send ButtonTo respond to the button's on-click event, open the main.xml layout file and add the android:onClick attribute to the <Button> element:<Button
//跳轉到連絡人介面private void pickContact() { // Create an intent to "pick" a contact, as defined by the content provider URI Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
Starting another activity doesn't have to be one-way. You can also start another activity and receive a result back. To receive a result, call startActivityForResult() (instead of startActivity()).For example, your app can start a camera app and
Android BroadcastReceiver介紹: broadcastReceiver是android的四大組件之一,大部分的廣播是系統發出來的。例如,螢幕關閉,電池電量不足等等。應用同樣可以建立廣播,例如:當下載完成的時候,要讓其他的應用知道這個情況,需要用到broadcastreceiver,receiver沒有介面,它可能會建立一個status bar notification通知使用者。broadcastreceiver
Use Density-independent PixelsOne common pitfall you must avoid when designing your layouts is using absolute pixels to define distances or sizes. Defining layout dimensions with pixels is a problem because different screens have different pixel