这是myDiary这个工程下MainActivity中的protected void onListItemClick(ListView l, View v, int position, long id){}方法,
new Intent(String action,Uri uri)构造器的具体说明如下,
1 protected void onListItemClick(ListView l, View v, int position, long id) { 2 // 重要 3 // Returns: a new URI with the given ID appended to the end of the path 4 Uri uri = ContentUris.withAppendedId(getIntent().getData(), id); 5 /* 6 * new Intent.Intent(String action, Uri uri)这种用法还不太熟悉 7 * 系统会根据第一个参数(action)在清单文件中找对应的activity,如果对应为多个activity, 8 * 此时就会弹出一个dailog选择Activity 9 */ 10 startActivity(new Intent(MyDiaryEdit.EDIT_TEXT_ACTION, uri)); 11 12 }