[英]Save an EditText value into Firebase on Android
I want to send a EditText (message) into the Firebase database. 我想将一个EditText(消息)发送到Firebase数据库中。 I can save a string but it does not work with a text area here is my code: 我可以保存一个字符串,但是它不适用于文本区域,这是我的代码:
Map<String, Object> updates = new HashMap<String, Object>();
updates.put("Your Message: ", textArea);
f.setValue(updates);
So I want to save a text area to the Firebase database. 因此,我想将文本区域保存到Firebase数据库。 I also want to know how I can send it to a specific entity for example. 我也想知道如何将其发送到特定实体。
save at Name: mystring or at ID: myid if there is a way to use JSON. 如果有使用JSON的方法,请保存在名称:mystring或ID:myid处。 I am new to Firebase. 我是Firebase的新手。
It sounds like you're working with an Android EditText view . 听起来您正在使用Android EditText视图 。
You probably don't want to store all of the state in Firebase, just the string value. 您可能不想将所有状态都存储在Firebase中,而只想存储字符串值。 The code to do that in Firebase would look something like this: 在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());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.