Validation for digit only at EditText Android - Java : I am trying to make a simple functionality which the user insert 2 numbers and a toast present the sum...
First, in order to do so, I would like to verify the user insert only digits. If not, i would like to set toast massage (error) explains that only digits allows here. I use a boolean isdigit (EditText input) method.
However I get an error -maybe because the for loop can not accept null?

    public class MainActivity extends AppCompatActivity {
    private EditText firstIntCB, secundIntCB;
    private Button getProductCB;

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

        addDataToDisplay();
    }
    
    public void addDataToDisplay() {
       if (isdigit(firstIntCB)==true && isdigit(secundIntCB)==true){
            firstIntCB = (EditText)findViewById(R.id.firstNumber);
            secundIntCB = (EditText)findViewById(R.id.secundNumber);
            getProductCB =(Button)findViewById(R.id.GetProduct);

            getProductCB.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Integer intFirst = Integer.parseInt(firstIntCB.getText().toString());
                    Integer intSec = Integer.parseInt(secundIntCB.getText().toString());
                    String product = Integer.toString((int)Math.pow(intFirst,intSec));
                    Toast.makeText
                            (getApplicationContext(),String.valueOf(product), Toast.LENGTH_LONG).show();
                }
            });
        }
    }

    public boolean isdigit(EditText input) {
        String data=input.getText().toString().trim();
        for(int i=0;i<data.length();i++)
        {
            if (!Character.isDigit(data.charAt(i)))
                return false;

        }
        return true;
    }
    