Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
import android.widget.EditText;
import android.widget.TextView;

import com.firebase.client.Firebase;
import com.udacity.firebase.shoppinglistplusplus.R;
import com.udacity.firebase.shoppinglistplusplus.utils.Constants;

/**
* Adds a new shopping list
Expand Down Expand Up @@ -89,9 +91,14 @@ public void onClick(DialogInterface dialog, int id) {
* Add new active list
*/
public void addShoppingList() {
// TODO Add code here to create or overwrite a node in Firebase called "listName"
// with the text that the user entered in the EditText mEditTextListName.
// This EditText is the one found in dialog_add_list with the id edit_text_list_name
// Get the reference to the root node in Firebase
Firebase ref = new Firebase(Constants.FIREBASE_URL);
// Get the string that the user entered into the EditText
String userEnteredName = mEditTextListName.getText().toString();
// Go to the "listName" child node of the root node.
// This will create the node for you if it doesn't already exist.
// Then using the setValue menu it will set value the node to userEnteredName.
ref.child("listName").setValue(userEnteredName);
}

}
Expand Down