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" />
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.
Comments