Reputation: 1
I'm new to Android Studio. So I have an edittext with an id of edittext1. I want to create a variable, x, which will be equal to the numeric input which is made by the user inside of the box. I can manipulate this later. I then want to show that input as the text of a different edittext, named edittext 2. How would I do this? This is what I have so far
EditText a = (EditText) this.findViewById(R.id.editText1);
EditText b = (EditText) this.findViewById(R.id.editText2);
public void buttonOnClick (View v){
int x = parseInt(a.toString());
Button button=(Button) v;
b.setText(x);
}
The app crashes when I click the button.
And I already did android:inputType="phone" to ensure that the input is numeric.
Thank you!
Upvotes: 0
Views: 96