I
I
Ivan2015-09-05 20:37:44
Android
Ivan, 2015-09-05 20:37:44

How to get integer value from string?

Good time of the day!
I have a variable of type integer i and a variable firstmat of type EditText

private int i = 0;
private EditText firstmat;

A number is entered in firstmat and I need to put it in i, I do it this way, but it's not correct and doesn't work =)
i = Integer.parseInt(firstmat.getText());
How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Emin, 2015-09-05
@shopogolik

i = Integer.parseInt(firstmat.getText().toString());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question