[英]Save an EditText value into Firebase on Android
我想將一個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視圖 。
您可能不想將所有狀態都存儲在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());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.