示例#1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle args = getArguments();
    glID = getArguments().getLong(EXTRA_GUESTLIST_ID);
    smGuestList = GuestListBank.get(getActivity()).getGuestList(glID);
    setHasOptionsMenu(true);
    getLoaderManager().initLoader(0, getArguments(), this);

    try {
      GuestListBank.get(getActivity()).getGuestList(1);
    } catch (NullPointerException e) {
      smGuestList = GuestListBank.get(getActivity()).addGuestList();
      Log.e(TAG, "Created Favorite Guestlist, id: ");
    }
  }
示例#2
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {

    if (item.getItemId() == R.id.action_add) {

      Guest NEWguest = GuestListBank.get(getActivity()).insertGuest();
      GuestListBank.get(getActivity()).inserGuestToGuestList(smGuestList.getId(), NEWguest);

      Intent i = new Intent(getActivity(), GuestActivity.class);
      i.putExtra(GuestFragment.EXTRA_GUEST_ID, NEWguest.getID());
      i.putExtra(GuestFragment.EXTRA_GUEST_LIST_ID, smGuestList.getId());
      startActivityForResult(i, REQUEST_CODE_GUESTFRAGMENT_CHANGE);

      Log.d(TAG, "Added new guest " + NEWguest.getID() + " to guestlist " + smGuestList.getId());
    }

    return super.onOptionsItemSelected(item);
  }
示例#3
0
    @Override
    protected Cursor loadCursor() {

      return GuestListBank.get(getContext()).gueryGuest(glID);
    }