My data is from Firebase cloud Firestore, it doesn't contain a slash "/" because every solution to this problem about this always tell me to use .replace("/","-"). The ID is a generic ID from Firebase "cHkncpz6RVHv4ITFlICr"
HomePageAdapter.java
Intent passID = new Intent(itemView.getContext(),Destination.class);
passID.putExtra("ID", destinationID);
itemView.getContext().startActivity(passID);
Destination.java
ID = getIntent().getStringExtra("ID");
firebaseFirestore.collection("DESTINATION").document(ID) <----- this line throws java.lang.IllegalArgumentException: Invalid document reference. Document references must have an even number of segments, but DESTINATIONS has 1
What I tried so far are:
- Replacing the String ID into
ID = "cHkncpz6RVHv4ITFlICr";and of course the app works. - Tracked if the ID is blank, it was not because the LOG says the ID is "cHkncpz6RVHv4ITFlICr".
Log.d("ID", destinationID);
returns
D/ID: cHkncpz6RVHv4ITFlICr
- Replaced the extra in Intent
passID.putExtra("ID", "cHkncpz6RVHv4ITFlICr");the app didn't work.
So what I conclude is the intent is causing this exception. Any help is much appreciated.