Firestore search across custom objects array - android

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

Related

Writing back to original places after retrieval from Firestore

I can successfully retrieve documents from firestore, the trouble is, i do not know how to put them back where they came from!!
My app is a court booking system, it uses 7 fragments that represent the days of the week. Each fragment contains buttons that represent booking slots throughout the day. When a button is pressed, the court booking activity fires showing textviews and spinners.
The information I save to firestore includes a unique number representing a datestamp and a booking id that represents the id of the button that was pressed.... from here, I am lost, i need to write the retrieved database info back to their relevant places but i dont have anything unique in the way of widgets. The buttons are unique but all they do is fire a non unique court booking activity... any help appreciated... sorry for length, quite possibly more to add when answering questions.
To write to a document in Firestore you need to know the complete path to that document. You'll need to track the necessary IDs in your code, in a way that you can synchronize it with your UI elements.
A simple first pass could be to add a non-editable view (e.g. a label) to your UI for each document, and set the document ID (or entire path) in there. Then when the user clicks a button, you find the corresponding view with the ID, and from that can recreate the DocumentReference that you need to update.

How to upload text view from android to a database in a website using a button

I'm currently doing a project from one of my subjects in my university. I'm about to do an attendance app that checks if the professors are present, late, or absent in the room based on the schedule. I made an app in an android studio which uses radio groups and radio buttons that will change the text in the text view which will show if the professors attendance status. I'm thinking of making a button that will upload the text views with the attendance statuses to a website which holds the data(database).
I'm not used to programming in the android studio that is why I would like to know if a way to upload the text views on a website. Thanks
It's quite simple, You have to create Weg api that you can call from the android mobile application and pass the current status of the professor or the whatever you want to pass on the server. That api will update the database as per whatever you have passed from the mobile application.
Also, One more thing that you can not pass the text view, you just need to pass the text of that view.
I hope, you will get answer from this.
Happy coding...
Assign value of textview to a string variable.
And use this string in your api to pass data.
For example if you have a textview with name teacher, you can get its value using this line.
String st_teacher = teacher.getText();
Now use that st_teacher value in your api to upload data.

Android - how to create custom word dictionary for only my application?

I have successfully added a word to Android's predefined user dictionary, but i want to create a custom dictionary which can only be accessed by my application.
For example: When i type "lol", the suggestions show me "laugh out loud" but when I want another meaning of "lol" then I can manually add another meaning of "lol" (eg, "xxxxxx" - so the next time the user writes "lol" in an EditText, the suggestions will show him "xxxxxx").
No other application should have access my dictionary data.
I have worked with spell checker class but it gives me only correct word and I can't my own word meanings.
Please give me some suggestions or links.
There is an Androids inbuilt class UserDictionary so that you can add your spells programmatically into that, Here is a link you can go through with , and which may relates to your problem .(In this solution nidhi has manged programmatically to retrieve data back)
Add word to user dictionary and retrieve them back from dictionary
In addition you can go through following links to :
http://developer.android.com/reference/android/provider/UserDictionary.html
http://developer.android.com/reference/android/provider/UserDictionary.Words.html
Moreover if you want a custom personal dictionary then manually you have to store words and retrieve them back .
Hope that helps !!!

Implementing OR Condition using Parse Android SDK?

I am new to Parse and i am working on a Project that uses Android PARSE Sdk so i was wondering on how can i make a where query with or condition using the android sdk.
I want to make a query like this [Psuedo code]
Select * from employ where employId is ("1","2","3")
I found this on parse documentation, i don't know if it helps or not.
Edit:
This is what i found on PARSE but its not working
String[] id= {"1","2","3"};
query.whereContainedIn("employId ", Arrays.asList(id));
It returns me an empty list but if i query them one by one i get result... Can anyone tell me whats wrong ?
You can use whereContainedIn to select specific rows. See this post you can get more ideas. https://www.parse.com/questions/different-arrays-and-wherecontainedin-for-android.
List<String> employId = new ArrayList<String>();
employId.add("1"); employId.add("2"); employId.add("2");
query.whereContainedIn("employId", employId);
If you are still not clear. check this https://www.parse.com/docs/android_guide#queries
I have found the solution and i must say its pretty lame of PARSE to not mention this anywhere in there documentation.
The problem was that the values that i was using inwhereContainedIn method were of type String but in reality they were pointers to another table's row.
I was trying to get the values using only there ids[as it is displayed on parse] but instead i had to pass the whole object in order to retrieve them. That was the reason on why it was returning empty list.
The thing is Even though it displays IDs [pointer to object in a table] we cant search using only ID's instead we have to use complete Parse objects if we want to search a table based on Specific Object.

Should I use database for only two string? (Android-java)

I have two edittext and save button. When application is started, last data will coming. I know SQL ite database for it but can I use a text file or another thing. Is Sqlite correct always? And can I give example for save data from two edittext , and I get data to edittext.
Developers Guide says:
"If you have a relatively small collection of key-values that you'd like to save, you should use the SharedPreferences APIs"

Categories

Resources