[Solved] Translation of Plus and Minus button previous and next to EditText Respectively Code that is in Kotlin to Java [closed]


So here is your code in Java:

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.increase).setOnClickListener(this)
        findViewById(R.id.decrease).setOnClickListener(this)
    }

    public void increaseInteger() {
        display(Integer.parseInt(integer_number.getText().toString()) + 1);
    }

    public void decreaseInteger() {
        display(Integer.parseInt(integer_number.getText().toString()) - 1);
    }

    private fun display(int number) {
        integer_number.setText(String.valueOf(number));
    }

    @Override
    protected void onClick(View v) {
        switch (v.getId()) {
            case R.id.increase:
            increaseInteger()
            break;

            case R.id.decrease:
            decreaseInteger()
            break;
        }
    }
}

I did it in notepad. So if you have any problem, let me know.

3

solved Translation of Plus and Minus button previous and next to EditText Respectively Code that is in Kotlin to Java [closed]