In Kinetise mobile app generator I want to init form fields (like Text Input) with some dynamic (from web service) values. How can I achieve this?
I found the answer myself so I share it if someone have similar problem:
You need to put Form widget into List widget.
Add List widget and connect it to your API exposing those initial values
Reduce items count to 1, disable SHOW MORE
Add Form widget inside that single-item List widget.
edit TextInput of that Form widget and set its initial value being read from proper node of API you pointed to in step 1.
Initial values of other Form fields should be handled accordingly.
Related
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.
Using Flutter I have a form that contains an AutoCompleteTextField, I am trying to get changing of the value of the text field working. The value to be edited is placed into the AutoCompleteTextField when the form is opened using the technique linked to my previous question:
How to set the initial value of Flutter autocomplete_textfield
Now I find that if I try to change the value of the field the autocompletion appears to work, but the new text does not appear in the form data when the form is submitted, the previous entry remains. I have tried adding the new text to the form data but this does not change the behavior.
The "itemSubmitted" code looks like:
itemSubmitted: (species) {
setState(() {
searchTextField.textField.controller.text = species.commonName;
});
The submit method calls validate and save on the form data:
if (_formKey.currentState.validate() == false) {
return;
}
_formKey.currentState.save();
What more do I need to do to get the new selection in the AutoCOmpleteTextField updated in the firm data?
Update:
It appears that if I start with a blank form I am able to search for an entry in the AutoCompleteTextField, save the data to my database (without clearing the form), search for a new value, and the data is correctly placed into the form data each time. This suggests that the initialization of the field when the form is opened is causing the issue.
Sid
This issue was entirely of my own making, I am using the same code to both create and edit an entry. To differentiate between new and edit I was testing for valid object being passed to the page, my mistake was that when my text search field was updated I was simply checking if there was a valid object had been passed to the page, of course, the new data was in the form data structure and was never being placed into the object being edited.
The solution was to simply first check if there is a valid input object, if there is then a secondary test is made to see if the form data matched the input object, if not the new data is then placed into the input object.
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.
I'm looking for simple way to create user defaults values for TextView in Android: I need the standart solution that user is seeing the previous value, that was entered by him to the TextView. Sure, there is way to store value of TextView at somewhere and then read it again while starting activity, but, may be, there is any simple tool to get what I wish ?
You can use SharedPreferences to store previous values and then get previous values from shared preferences to set as default values
Just to get your question correctly:
You want to present the values the user selected/set in his last visit?
You can save those values in the SharedPreferences - That's what they're made for.
You can give the google prediction api a try.
Is it possible to use AdapterView with text fields in android?
My query returns a set of values and for each I want to place that within a textfield, so that the user may edit the value.
Also, I want to click a button to create a new empty field, so that I may insert a new entry.
If you know of good example, then please let me know!
EDIT 1
I would prefer to use XML to define ui and I found this informations:
"In this case we create a new id called text1. The + after the # in the id string indicates that the id should be automatically created as a resource if it does not already exist, so we are defining text1 on the fly and then using it." Source http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html
Will this + allow me to autocreate as many fields as needed? Is there a way I can generically specify the layout in XML and then create fields adhoc based on db response?
Many thanks,
Mith
Is it possible to use AdapterView with
text fields in android?
Yes. It will be complex for you (and possibly also for the user), so I would not recommend it unless you have a few months' Android programming experience, but it should work.
Also, I want to click a button to
create a new empty field, so that I
may insert a new entry.
That will get a little complicated.
Will this + allow me to autocreate as
many fields as needed?
No, that is not how you use ListAdapters for ListView rows.
Is there a way I can generically
specify the layout in XML and then
create fields adhoc based on db
response?
Use a CursorAdapter.
Here is a free excerpt from one of my books that describes creating custom adapter classes. Here is a sample project that shows creating a custom CursorAdapter to display the results of a database query.