My listview is from a fragment and I want to pass all the inputted data at once in the listview to firebase. I have not seen any source about "ListView to Firebase" it's usually "From Firebase to ListView" so I have decided to ask this question.
This is what I did temporarily until I find the solution on passing values from ListView to Firebase Realtime Database. I don't know how to put values from ListView to Firebase so what I did is to put items from EditText to Firebase in a click of a button which is not what I needed.
private void AddpackageinfoButton_Click(object sender, EventArgs e)
{
if (infonamecrud.add(packageinfonameText.Text) && infoqtycrud.add(packageinfoqtyText.Text))
{
string packageinfoname = packageinfonameText.Text;
string packageinfoqty = packageinfoqtyText.Text;
Java.Util.HashMap packageinfo = new Java.Util.HashMap();
packageinfo.Put("infoName", packageinfoname);
packageinfo.Put("infoQty", packageinfoqty);
{
DatabaseReference newPackageInfoRef = AppDataHelper.GetDatabase().GetReference("packageinfo").Push();
newPackageInfoRef.SetValue(packageinfo);
}
infonameadapter = new ArrayAdapter(this.Activity, Android.Resource.Layout.SimpleListItem1, infoName);
packageinfonameListView.Adapter = infonameadapter;
infoqtyadapter = new ArrayAdapter(this.Activity, Android.Resource.Layout.SimpleListItem1, infoQty);
packageinfoqtyListView.Adapter = infoqtyadapter;
}
}
else
{
Toast.MakeText(this.Activity, "Please input all fields!", ToastLength.Long).Show();
}
}
FOR MORE DETAILS:
This is my layout and the ADD INCLUSIONS Button doesn't have a function. It is for the items in listview to be passed in database all at oncec.
This is how it would look like in the firebase. I need them all in one key.
What I need is passing all items in listview all at once. I just temporarily applied the hashmap every add button just to fill up the database and but the problem is the retrieval because they would have different key values.
Is there any syntax for this? Thank you so much for future answers. I appreciate it a lot! :)