How can I save EditText input as class attribute in Kotlin/AndroidStudio?

Georgia

I have a class called Symptomz, which has the attribute "notes" as a string and "intensity" as an int. I would like to link the information received on user input of EditText to become the data stored in the attribute "notes" and the "intensity" attribute to contain information received from the seekbar.

open class Symptomz(notes:String, intensity:Int) {
var intensity:int
var notes:String

init{
    this.notes = notes
    this.intensity = intensity
}
public override fun toString():String {
    return notes
}

Here is the XML:

<EditText
    android:id="@+id/addNotesToSymptom"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginBottom="181dp"
    android:ems="10"
    android:gravity="start|top"
    android:importantForAutofill="no"
    android:inputType="textMultiLine"
    android:visibility="gone"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintStart_toStartOf="@+id/checkBox2"
    app:layout_constraintTop_toBottomOf="@+id/checkBox2" />

<SeekBar
    android:id="@+id/seekBarSymptomIntensity"
    style="@android:style/Widget.DeviceDefault.SeekBar"
    android:layout_width="256dp"
    android:layout_height="22dp"
    android:layout_marginTop="61dp"

    android:layout_marginEnd="124dp"
    android:layout_marginBottom="66dp"
    android:clickable="true"
    android:filterTouchesWhenObscured="false"
    android:focusable="true"
    android:indeterminateBehavior="repeat"
    android:isScrollContainer="false"
    android:max="100"
    android:progress="0"
    android:thumb="@android:drawable/alert_dark_frame"
    app:layout_constraintBottom_toTopOf="@+id/checkBox2"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/spinner" />
redalertexpert

I'm not sure if you can link it directly, but you can access the EditText content via

val edit: EditText = findViewById(R.id.addNotesToSymptom);
val result : String = edit.getText().toString();

Just use the EditText directly whenever you need it :)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I use setAttribute on an input without an ID or class attribute?

From Dev

How can I make a form remember the input for a virtual attribute?

From Dev

How can I add the 'required' attribute to input on change of textarea?

From Dev

How can I add attribute inside an input tag using jQuery?

From Dev

How I can add attribute to certain type of input

From Dev

how can I set-attribute to input Element

From Dev

how can i save input from joptionpane as an array?

From Dev

How can I save user input as a variable in javascript with a button onclick?

From Dev

How can I specify a class attribute in new_tag()?

From Dev

How can I cache API data in a class attribute?

From Java

No attribute 'compile', how can I modify the class, so that it works?

From Dev

How can I "un-JsonIgnore" an attribute in a derived class?

From Dev

How can I type hint a dynamically set class attribute in a metaclass?

From Dev

How can I select same attribute without using class or id?

From Dev

Cython: how can I set the attribute of a cdef class?

From Dev

How can I add a class, id or attribute to a twig include?

From Dev

How can I save my toggled class names?

From Dev

How can i save a QList of a own class using QSettings in QT?

From Dev

How can i save the desired data on EditText by using onSaveInstanceState() and onRestoreInstanceState() methods

From Dev

How can I set the 'size' attribute for the element <input> using an attribute object?

From Dev

How do I get an EditText input into a variable

From Dev

How can I make my bash script open cat for input, and then save input to a variable in the script

From Dev

How can I use a Java Text Field as input for a class name?

From Dev

How Can I Input A Custom Class Value Via Scanner?

From Dev

Can I save regex state for next input?

From Dev

how can create specific input type on edittext? The input accettable is Roman numbers M D C X V I

From Java

Why can I change the private attribute in the class?

From Dev

Python, Class has no Attribute. How can I return a value of a value that has been passed into class?

From Dev

I can't input the obelus(division symbol) in edittext android

Related Related

  1. 1

    How can I use setAttribute on an input without an ID or class attribute?

  2. 2

    How can I make a form remember the input for a virtual attribute?

  3. 3

    How can I add the 'required' attribute to input on change of textarea?

  4. 4

    How can I add attribute inside an input tag using jQuery?

  5. 5

    How I can add attribute to certain type of input

  6. 6

    how can I set-attribute to input Element

  7. 7

    how can i save input from joptionpane as an array?

  8. 8

    How can I save user input as a variable in javascript with a button onclick?

  9. 9

    How can I specify a class attribute in new_tag()?

  10. 10

    How can I cache API data in a class attribute?

  11. 11

    No attribute 'compile', how can I modify the class, so that it works?

  12. 12

    How can I "un-JsonIgnore" an attribute in a derived class?

  13. 13

    How can I type hint a dynamically set class attribute in a metaclass?

  14. 14

    How can I select same attribute without using class or id?

  15. 15

    Cython: how can I set the attribute of a cdef class?

  16. 16

    How can I add a class, id or attribute to a twig include?

  17. 17

    How can I save my toggled class names?

  18. 18

    How can i save a QList of a own class using QSettings in QT?

  19. 19

    How can i save the desired data on EditText by using onSaveInstanceState() and onRestoreInstanceState() methods

  20. 20

    How can I set the 'size' attribute for the element <input> using an attribute object?

  21. 21

    How do I get an EditText input into a variable

  22. 22

    How can I make my bash script open cat for input, and then save input to a variable in the script

  23. 23

    How can I use a Java Text Field as input for a class name?

  24. 24

    How Can I Input A Custom Class Value Via Scanner?

  25. 25

    Can I save regex state for next input?

  26. 26

    how can create specific input type on edittext? The input accettable is Roman numbers M D C X V I

  27. 27

    Why can I change the private attribute in the class?

  28. 28

    Python, Class has no Attribute. How can I return a value of a value that has been passed into class?

  29. 29

    I can't input the obelus(division symbol) in edittext android

HotTag

Archive