標籤:
1.android.provider包下的常用類
該包下提供了訪問連絡人資訊,行事曆資訊,多媒體檔案的類。
常用的類。
MediaStore.Audio.Media類
public static final Uri EXTERNAL_CONTENT_URI;
The content:// style URI for the "primary" external storage volume.
String DEFAULT_SORT_ORDER ;//The default sort order for this table
2.建立菜單
OptionMenu:使用者點擊“Menu”鍵後,顯示在介面的底部的菜單
ContextMenu:使用者長按列表上的item時,會顯示出來一個菜單
在Activity裡覆蓋這兩個方法
@Override public boolean onCreateOptionsMenu(Menu menu) { //調用add方法添加菜單選項// menu.add(0,OPTON_ITEM_EXIT, 0, R.string.option_exit);// menu.add(0,OPTON_ITEM_SCAN, 1, R.string.option_scan); //第二種方法使用Menuinflater方法布局選項 MenuInflater menuinflater=getMenuInflater(); menuinflater.inflate(R.menu.option_menu, menu); return true; } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { //為該listview註冊contextmenu //布局contextmenu,也可以使用menuinflater來指定xml布局 menu.add(0, CONTEXT_OPTION_DELETE, 0,R.string.context_option_delete); menu.add(1,CONTEXT_OPTION_PROPERTY,0,R.string.context_option_property); registerForContextMenu(getListView()); }
3.Dialog
android提供了4種類型的dialog:AlertDialog,ProgressDialog,DatePickerDialog,TimePickerDialog
android使用者介面設計