cuando trato de usar los datos de entrada con el administrador de trabajo, arroja una excepción: java.lang.NumberFormatException:Input"", significa que las variables utilizadas están vacías pero se completan en la interfaz gráfica de usuario. También probé convirtiendo la variable a int pero es lo mismo, el problema es que no es la entrada

actividad principal.java

public class MainAvtivity extends AppCompatActivity {
Button btNn;
EditText value1, value2;

public static final String VALUE1 = "value1";
public static final String VALUE2 = "value2";

@SuppressLint("WrongViewCast")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    value1 = (EditText)findViewById(R.id.Firstvalue);
    value2 = (EditText) findViewById(R.id.Secondvalue);
    btNn = (Button)findViewById(R.id.calculate);

    String Value1 = value1.getText().toString().trim();
    String Value2 = value2.getText().toString().trim();

    Data DATa = new Data.Builder()
            .putString(VALUE1, Value1)
            .putString(VALUE2, Value2)
            .build();

    final OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(smabullsetwork.class)
            .setInputData(DATa)
            .build();

    btNn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            WorkManager.getInstance().enqueue(workRequest);
        }
    });
}

archivo del administrador de trabajo

public class calculator extends Worker {

public claculator(@NonNull Context context, @NonNull WorkerParameters workerParams) {
    super(context, workerParams);
}

@NonNull
@Override
public Result doWork() {

    Data data = getInputData();
    String valuee1 = data.getString(MainActivity.VALUE1);
    String valuee2 = data.getString(MainActivity.VALUE2);

    int Value1 = Integer.parseInt(valuee1);
    int value2 = Integer.parseInt(valuee2);
    int result = value1*value2;
    DisplayNotiFication("Result is...", result);

    return Result.success();
}
respuesta

Debe llamar a getText y construir su variable DATa dentro de setOnClickListener, su código será:

    public class MainAvtivity extends AppCompatActivity {
      Button btNn;
      EditText value1, value2;

      public static final String VALUE1 = "value1";
      public static final String VALUE2 = "value2";

      @SuppressLint("WrongViewCast")
      @Override
      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        value1 = (EditText) findViewById(R.id.Firstvalue);
        value2 = (EditText) findViewById(R.id.Secondvalue);
        btNn = (Button) findViewById(R.id.calculate);

        btNn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            String Value1 = value1.getText().toString().trim();
            String Value2 = value2.getText().toString().trim();

            Data DATa = new Data.Builder()
              .putString(VALUE1, Value1)
              .putString(VALUE2, Value2)
              .build();

            final OneTimeWorkRequest workRequest = new OneTimeWorkRequest.Builder(smabullsetwork.class)
              .setInputData(DATa)
              .build();
            WorkManager.getInstance().enqueue(workRequest);
          }
        });
      }