How can I update the editText
field with a button when the button and the editText
are on different layouts and classes?
I have a mainActivity
class and layout but I wand to add this function to an intent (by clicking the save button update main_activity layout). I tried by calling the saveDegrees
method onClick
in the intent class but that didn't work.
After that I want to go back to the main_activity
layout. My saveDegrees
code is this:
public void saveDegrees(View view) {
LayoutInflater inflater = getLayoutInflater();
View activityView = inflater.inflate(R.layout.activity_main, null);
mCompassEditText = (EditText) activityView.findViewById(
R.id.compass_edit_text);
mCompassEditText.setText(toString().valueOf(currentDegree));
}