May you help us with our school project it's due Thursday. we have a problem when we use push() to insert data to the Firebase Realtime Database we trying to remove values from randomly generated key and it works but only removed from the app but NOT in Realtime Database we can't figure out what is the problem, please we need your help
push() --> in Additem.class
private void StoreProductInformation() {
Description = InputProductDescription.getText().toString();
Pname = InputProductName.getText().toString();
citem obj = new citem(Pname,Description );
ProductsRef.push().setValue(obj);
Toast.makeText(Additem.this, "Added To cart", Toast.LENGTH_SHORT).show();
Intent i =new Intent(this,shoppingcart.class);
startActivity(i);
}
removeValue() --> in shoppingcart.class
list.setAdapter(myadapter);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
AlertDialog.Builder adb=new AlertDialog.Builder(shoppingcart.this);
adb.setTitle("Delete?");
adb.setMessage("Are you sure you want to delete " + position);
final int positionToRemove = position;
adb.setNegativeButton("Cancel", null);
adb.setPositiveButton("Ok", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
mylist.remove(positionToRemove);
myadapter.notifyDataSetChanged();
//myRef.child("key").removeValue();
}});
adb.show();
}
});