Skip to content

Instantly share code, notes, and snippets.

Created January 17, 2018 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/57ce7f5d6af61b9122c0ba498e0a4cb9 to your computer and use it in GitHub Desktop.
Save anonymous/57ce7f5d6af61b9122c0ba498e0a4cb9 to your computer and use it in GitHub Desktop.
package com.example.cris.zeiterfassungv2;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
public class Sum implements TextWatcher {
MainActivity ze;
public Sum (MainActivity Zeiterfassung) {
ze = Zeiterfassung;
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2)
{
}
@Override
public void afterTextChanged(Editable editable) {
EditText txt3 = (EditText) ze.lastRow.getChildAt(3);
EditText txt4 = (EditText) ze.lastRow.getChildAt(4);
EditText txt5 = (EditText) ze.lastRow.getChildAt(5);
if(!txt3.getText().toString().equals("") && !txt4.getText().toString().equals("") && txt5.getText().toString().equals(""))
{
String n1 = txt3.getText().toString();
int n11 = Integer.parseInt(n1);
String n2 = txt4.getText().toString();
int n22 = Integer.parseInt(n2);
txt5.setText(String.valueOf(n22 - n11));
}
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment