@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // Check which request we're responding to if (requestCode == REQUEST_STRING) { // check status????? // Log.d(TAG, "onActivityResult(): REQUEST_STRING"); strngdata_adapter.notifyDataSetChanged(); } }
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info; try { // Casts the incoming data object into the type for AdapterView objects. info = (AdapterView.AdapterContextMenuInfo) menuInfo; } catch (ClassCastException e) { // If the menu object can't be cast, logs an error. Log.e(TAG, "bad menuInfo", e); return; } StrngData strngdata = strngdata_adapter.getItem(info.position); menu.setHeaderTitle("Action: " + strngdata.toString()); getActivity().getMenuInflater().inflate(R.menu.string_list_item_context, menu); }
@Override public boolean onContextItemSelected(MenuItem item) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo(); int position = info.position; StrngData strngdata = strngdata_adapter.getItem(position); switch (item.getItemId()) { case R.id.menu_item_edit_string: Intent i = new Intent(getActivity(), StrngDataActivity.class); i.putExtra(StrngDataFragment.EXTRA_RACKET_ID, mRacket.getId()); i.putExtra(StrngDataFragment.EXTRA_STRINGDATA_ID, strngdata.getId()); startActivityForResult(i, REQUEST_STRING); return true; case R.id.menu_item_delete_string: alertMessageDeleteString(strngdata); return true; } return super.onContextItemSelected(item); }