Ejemplo n.º 1
0
  private List<ClientDTO> createClientsList() {
    DBWork db = new DBWork(context.getApplicationContext());

    // List<String> clientlables = db.getAllClientsName();

    List<ClientDTO> data = db.getAllClientsNameDTO();

    return data;
  }
Ejemplo n.º 2
0
  @Override
  public boolean onContextItemSelected(MenuItem item) {
    // return super.onContextItemSelected(item);
    // RecyclerContextMenuInfo info = (RecyclerContextMenuInfo) item.getMenuInfo();

    AdapterView.AdapterContextMenuInfo info =
        (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();

    int clickedItemPosition = item.getOrder();

    switch (item.getItemId()) {
      case 1:
        Intent intent_client = new Intent(this.getActivity(), AddClientActivity.class);
        startActivityForResult(intent_client, CLIENT_ACTIVITY_CREATE);
        // MainActivity.editClient();
        break;
      case 2:
        dbHelper.deleteClient(clickedItemPosition);
        Toast.makeText(this.getActivity(), "Delete" + clickedItemPosition, Toast.LENGTH_LONG)
            .show();
        fillData();
        return true;
    }
    return super.onContextItemSelected(item);
  }