So I understand hashmaps usually have keys and values. I looked around and it was advised that if I want to display 3 values, I should use nested hashmaps. But now, I am unable to get the data from the hashmap. Please give me pointers on how I can improve the code below.
Initial code (Working)
String todo = task.getText().toString().trim();
String description = desc.getText().toString().trim();
Map<String, String> dataToSave = new HashMap<>();
dataToSave.put("todo", todo);
dataToSave.put("description", description);
Current code (Not working)
ListItems is a Java class where I defined to-do and description. I want to map userid to the key, and the to-do + description as a value.
String todo = task.getText().toString().trim();
String description = desc.getText().toString().trim();
String userid = mAuth.getCurrentUser().getUid();
Map<String, ListItem> dataToSave = new HashMap<>();
dataToSave.put("user", userid);
dataToSave.put("todo", BLANK);
dataToSave.put("description", BLANK);
So, the portions I put BLANK are actually the ones I need help in. How can I map the todo and description?
Thanks in advance.