• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help for a beginner

JUSDroid

Lurker
Greetings all.

Just looking for a bit of a lifeline. I am new to both Android and Java, so please excuse my green-ness :o

While reading through the API guides and various developer tutorials, I came across the following jargon in variable declarations:


EditText editText = (EditText) findViewById(R.id.edit_message);

so, I understand that in this we are creating a new object of type EditText called editText. Curious about the (EditText) in brackets after the = sign. What does this mean? Does this mean that we are creating a new instance? Are we only creating an empty variable, or is it simply a reference to the previously existing EditText object returned by findViewById?

How would this differe from :
EditText editText = findViewById(R.id.edit_message);

I am not looking for a lesson on Java here, but just a quick explaination of what the extra bracketed variable type is doing, and perhaps a link to a tutoral website that explains this jargon usage in more detail.

Any help is greatly appreciated.

Regards,
JUS.
 
Back
Top Bottom