Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Android Java code confusion for beginner

Status
Not open for further replies.

syedshan

Advanced Member level 1
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top