我想将 EditText(消息)发送到 Firebase 数据库中。我可以保存一个字符串,但它不适用于文本区域,这是我的代码:
Map<String, Object> updates = new HashMap<String, Object>();
updates.put("Your Message: ", textArea);
f.setValue(updates);
所以我想保存一个文本区域到Firebase数据库。例如,我还想知道如何将其发送到特定实体。
如果有使用 JSON 的方法,请保存在名称:mystring 或 ID:myid。我是 Firebase 的新手。
最佳答案
听起来您正在使用 Android EditText view .
您可能不想在 Firebase 中存储所有状态,只存储字符串值。在 Firebase 中执行此操作的代码如下所示:
EditText myEditText = (EditText)findViewById(R.id.my_edit_text);
Firebase mFirebaseRef =
new Firebase("https://<your-firebase>.firebaseio.com/some/path");
myFirebaseyRef.setValue(myEditText.getText().toString());
关于java - 将 EditText 值保存到 Android 上的 Firebase,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27321531/