I started learning Android Studio and Java after c #, js, php. During the study, every time I wondered why it was so difficult to work with the elements created on the layout? What happens to the variables? What is the strength of this approach?
For example, in order to get the text contained in the EditText, you need to do the following operation:
EditText userField = (EditText) findViewById(R.id.userFiledEditText); String s = userField.getText(); It's horrible! And even if after Sharp you don’t pay attention to the absence of var and the fact that you can’t refer directly to the elements whose IDs are already assigned (like js), THAT what .. person cannot immediately work with the result of the function?!?! What ?! Or do I not know something?
Toast.makeText(getApplicationContext(),R.id.userFiledEditText).getText(), Toast.LENGTH_SHORT).show(); Dear, who is able to correctly explain this fact to me? I believe that all this is done for the sake of something good and carries a meaning, but I want to understand.
PS: without holivar and kicks from gurus javistov.
@BindView(R.id.userFiledEditText) EditText userField;- Victor Khovanskiy