One String value is coming from my firebase:
if (task.isSuccessful()) {
// binding.contentMain.noData.setVisibility(View.GONE);
for (QueryDocumentSnapshot document : Objects.requireNonNull(task.getResult()))
postMap.putAll(document.getData());
try {
if (postMap != null)
//binding.desc1.setText(Objects.requireNonNull(postMap.get(CONTENT)).toString());
binding.desc1.setText(Html.fromHtml(Objects.requireNonNull(postMap.get(CONTENT)).toString()));
} catch (Exception e) {
e.printStackTrace();
}
}
Now, I'll tell you what is coming inside String from Firestore, Actually I only manually written as a String field inside Firestore collection.:
This is the first text.
This is a second text.
This is the third text.
Done.
Make sure that above line is just one String/firestore field.
In firestore, I stored the above value as a String
, and fetching that value and showing it in Android. But it is not taking a new line. Instead, it is showing written
along with other characters.
I tried with and without HTML. with
and
.
UPDATE: You can see below image how I stored in Firestore.
https://drive.google.com/open?id=19yry9top_W8LREw5SEaZKWYWSlnCP1io
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…