Im learning android development and they give an example with this syntax:
Button button = (Button) findViewById(R.id.button_id);
The 'Button' word tells the compiler to create an object from the class Button. The syntax to the rigth of the equal sign confuses me. The code is creating an object, but the rigth side of it doesn't seem to create an object.
I've searched and found that there are some ways to create an object: What are all the different ways to create an object in Java? but none of them uses the syntax in the example.
The one that is similar is this one:
MyObject object = (MyObject) Class.forName("subin.rnd.MyObject").newInstance();
but it uses the keyword "Class.forName"...
So, could someone explain to me exactly what each part of the code means? Is "findViewById" part of java or its like a 'macro' for the compiler to link the button object to the screen?
I'm a little bit confused with some concepts. I would like to understand this interaction between java code and SDK code.