I'm new in Firebase realtime database, and I have to save some special characters in the database like the following:
https://myProject.firebaseio.com/myProject/en/$fanny/weight
Note: the child could contain any special character not just only $
How could I handle such like this issue please?
As I see there are some guys are replacing the characters, but in my case I should not change the values, because I have to display it to the users as is because it has a meaningful to the user.
The only solution is to replace the invalid characters in the keys.
If you need to display the original value to the user, also store it as a value.
Related
I try to make an app on Android for services reviews, every review is save like an element in the document "user" like this-
Everytime the user save a report I have see if inside the reports the field "plate" is existing comparing with the new one, I try query using the examples in the page arrays in Firebase
In the code i tried get with "whereEqualTo" method search by "reports.plate" or with the method "whereArrayContains" with the same field (the filter uid exits but in the first image doesn't show) any idea how i can search the document when some of the custom elements fields is equal
maybe sorry in advance for the english i'm practicing
Thanks in advance
I have Firebase data structure like this:
As you can see in the image, the value of OT1, OT1_B, etc. is Integer. Now, I want such a validation that no one can save value of other data-type for this key.
How can set I rule for this kind of restriction?
There is a rule available to validate your data in FireBase RealTime Database. Use .validate rule to check if your data is a string or other type and you can also use regular expression to check the matches.
Refer the official documentation to check how to Validate Data under section
Validating Data.
If you are taking user input for that fields then simply adding ,
android:inputType="numberDecimal"
will do a work for you
i am new to android development,so dint get me wrong. I am developing an application in which a text is generated.which is normally a word. The word is checked in a database for is corresponding value pair. Here the word is the key and its corresponding value is the value .
Since the text is auto generated it sometimes goes wrong(mis spelled). How do i perform a check of auto generated word to match with the mostly matched letters in the database of key word.
example: auto-generated word(key) - value
americ:
america : a country
Here the auto generatd word is americ(key) is not matched since it only contains america in its pair set.it need to be corrected as america.
You are probably using SQLite. Your best bet is soundex, which is desribed here.
Soundex has many shortcomings, but it might get you started. If you want a real measure, then go with Levenshtein distance, which is not built into the database (as far as I know).
I am trying to develop a user input form where i take his details and store them
in the form i have fields for his name, email, address, phone number etc.
a person may have multiple emails or multiple phone numbers.
he can add a field by clicking a button.
and then i want to store the data entered by the user in a shared preference.
i have a question:
how do i retrieve data from dynamically added extra fields by the user?
I have maintained a count for dynamically added fields for each field criteria (like email, phone etc)
but i am stuck at the point where i am supposed to retrieve the data when i need to store them in Shared Preferences.
Please help! thankyou in advance.
Is it possible using something like ParentViewGroup.getChildCount() or something else?
Sure, you can use getChildCount() and getChildAt() methods to retrieve child from a ViewGroup.
However, I think the better way is to save the references to the Views you added when you add them into the View hierarchy, and get data from these references.
This is the problem:
I have a form for inputting names, then saves it, then displays it in another activity. But once I try to enter another name, the previous name is overwritten by the new name.
Is there a way to set these names up to list themselves one after another without overwriting each other in SharedPreferences?
You can as long as they have distinct names. Ig you need multiple values for same name, you can store JSON array or use some form of prefix / suffix solution to provide unique names
Either do it like Konstantin Pribluda suggested, or you might think of using the SQLite, if you have a lot of names you want to store (e.g. if creating a history of typed in names). That way you can store unlimited values for the same key and retrieve them as a list/cursor.
But of course that's overkill if you only have 2-3 names…
you can also save a Set of Strings in the SharedPreferences.