I have a recylerview with edit text on its row which is populated with values coming from the server.
Now the user will be able to add some edit text and some not. My problem is that if user entered some values in edit text then I am able to get these values and other not. Lets say recylerview has 5 edit text and user entered values in 2 edit text then I have to receive these 5 edit text values into containing activity of adapter.is that possible or edit text is recommended on rv?
You can add a text change listener to the edit texts
refer: android on Text Change Listener
Related
In my piece of code there is one input box so data will be fetched in that box on drop down selection. And if user do not want to insert/update/delete that data and click on save button unnecessarily then i have to show an error message that: "There is nothing to save..You pressed the save button unnecessary."
Currently , i am checking if the data in input box is equals to the database value then show that error but its not working.
if (inputVal1.equals(dbVal1.getValue()) && inputVal2.equals(dbVal2.getValue())) {
addPageError(T_NOTHING_TO_SAVE);
}
Please suggest how to handle this validation in java.
Store the data in a separate variable and simply compare it to the current values in the input box. If you do this, you could even detect if the values were changed, but then changed back to the original value. Apart from this you could also even deactivate the button and compare in an edit-event of the input box if the content has really changed and enable the button accordingly.
I am working on a recylerview which contains several edit text and 2 textview beside each edit text. Initially I want empty edit text when activity is loaded, after that putting some values in 1 or more edit text randomly. I do not want to loose the value on scroll up or down. Please provide a solution for that if possible.
I looked on google but didn't find what exactly i am looking for.
I want a edit text to have text or image which i can change by tapping it and selecting new text or image. Also i want hint followed by that text or image.
I tried multiple experiment and was able to add text(by changing selection location and adding text) and image(using drawable addition from android code)
For text :
edt.setText("Fixed Text");
Selection.setSelection(edt.getText(), edt.getText().length());
Image through XML:
android:drawableLeft="#drawable/ic_launcher"
But when i add text, i won't be able to add hint. In case of image hints get added. Also i want my permanent text and image to be tappable and updatable.
Any help would be really helpful. I want $ to be fixed and tappable, and want to change it to different currency. but want 52.63 to be hint and can be editable by user tap.
EDIT to give more clarity:
Example: i want to add part of the text as permanent and part as hint for example $ 52, so $ is permanent and not editable through user, he can select it through list view by tapping on $, but 52 he can change using android keyboard.
I am not quite sure about the whole part about the image being placed into the EditText as a hint, but if you wanted to create the $52.63 as a hint in the EditText, all you would have to do is:
edt.setHint("$52.63");
in your onCreate() method. I am not sure if this is what you are looking for, but this is a simple way to add a hint to a textEdit. If you wanted the hint to change when the user tapped the screen or something like that, I would look into adding a tap listener of the android component that you desire to be tapped to change the hint, and then modify the hint using the method above.
I'm trying to make a Quizz, and I've created multiple PanCards(15), each having a question and 4 answers (radio buttons or check boxes or text fields) and I'm trying to export what the user clicks/introduces in a *.txt file.
Is there any method to do it more quick? Or I should create an eventListener for each question and if the checkboxes are selected, I'll write them separately.
I can't figure out how am I supposed to know how many checkboxes will going to be selected, since each pan has 4 checkboxes from which the user can select from 0 to 4 answers and the radio buttons are grouped as buttonGroup(1,2,7,8,13)
So, I can't do something like this:
for (int i=0; i
Any ideas?
I don't think you need eventlisteners for every element. The way I see it you don't want the info about the checkboxes/text fields when the user just filled them in. You should just check the status of your checkboxes and textfields when the user is done with the specific quiz question, which is when for example the user presses a button labeled "Next question".
I have a jtextarea that is not editable. It has some text in it. What i want is that when a user clicks in the jtextarea, (preferably single click), the entire line be highlighted, and this highlighted text be retrieved.
Each line actually has an email of the form name#emailid.com. To select the entire text would require triple clicks. I want the email to be selected in a single click. Is this possible?
Sure. Just implement you own listener and call http://java.sun.com/javase/6/docs/api/javax/swing/text/JTextComponent.html#select%28int,%20int%29 on the JTextArea.
But wouldn't a JList not rather fit your requirements?