Android Java code confusion for beginner

Status
Not open for further replies.

syedshan

Advanced Member level 1
Joined
Feb 27, 2012
Messages
463
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Jeonju, South Korea
Activity points
5,134
Dear all

Hope everyone is doing great.
I am learning Android for the first time. I have done the a code thru tutorial which is working great.
Although my code works great. However, I want to inquire about the following code.

please see the
new View.OnClickListener() {....}
since I have seen this first time, I cannot understand what it says...For details excerpt please see the code below.

Code:
mainButton2 = (Button) findViewById(R.id.main_button2);
mainButton2.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
				if(mainTextView.getText() == "Button pressed!" | mainTextView.getText() == "Button pressed unpressed")
					mainTextView.setText(""); 
				else
					mainTextView.setText(" Please press the top button");
             }
         });
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…