IF/ELSE password in Android I'm very new to Android programming so please forgive me if this is a stupid query.  I have an Edittext for a password field, and a button to submit the password. I also have a couple of Textviews which are hidden (shows if password is correct/incorrect), which I'd like to turn visible using an if/else statement.   When I run the code (on an AVD), nothing happens when I click the submit button. At all, ever.  I know this is probably really simple, but looking at other answers on questions similar to this was no help, I've been trying for days to figure out what I'm doing wrong...  ..So ANY help would be really really appreciated. Thank you!! :D   -I use Eclipse, and Android 4.2.2  Here's the Java part:  final TextView success = (TextView) findViewById(R.id.textView1); final TextView failure = (TextView) findViewById(R.id.textView2); Button firstButton = (Button)findViewById(R.id.button1); final EditText userPassword  = (EditText)findViewById(R.id.passwordField); firstButton.setOnClickListener( new View.OnClickListener(){     public void onClick(View v){          if(userPassword.getText().toString() == "pa$$word"){             success.setVisibility(View.VISIBLE);         }         else{            failure.setVisibility(View.VISIBLE);         }     } });   XML:  &lt;Button android:layout_height="wrap_content"  android:layout_width="wrap_content"  android:text="@string/button"  android:layout_marginBottom="75dp"  android:layout_centerHorizontal="true"  android:layout_alignParentBottom="true"  android:id="@+id/button1"/&gt;   &lt;EditText android:layout_height="wrap_content"  android:layout_width="wrap_content"  android:layout_centerHorizontal="true"  android:id="@+id/passwordField"  android:inputType="textPassword"  android:ems="10"  android:layout_above="@+id/button1"&gt;   &lt;requestFocus/&gt;  &lt;/EditText&gt;  &lt;TextView android:layout_height="wrap_content"  android:layout_width="wrap_content"  android:text="@+string/pwCorrect"  android:layout_marginBottom="124dp"  android:layout_centerHorizontal="true"  android:id="@+id/textView1"  android:layout_above="@+id/passwordField"  android:visibility="gone"/&gt;   &lt;TextView android:layout_height="wrap_content" android:layout_width="wrap_content"  android:text="@+string/pwIncorrect"  android:layout_centerHorizontal="true"  android:id="@+id/textView2"  android:visibility="gone"  android:layout_centerVertical="true"/&gt;
How do I compare strings in Java? I've been using the == operator in my program to compare all my strings so far. However, I ran into a bug, changed one of them into .equals() instead, and it fixed the bug.  Is == bad? When should it and should it not be used? What's the difference?
Prove that for any piecewise smooth curve it is possible to find the parametrisation Normal subgroups of $S_4$ Can anyone tell me how to find all normal subgroups of the symmetric group $S_4$?  In particular are $H=\{e,(1 2)(3 4)\}$ and $K=\{e,(1 2)(3 4), (1 3)(2 4),(1 4)(2 3)\}$ normal subgroups? How to make an extension function for getting variable or property name like ToString() Alignment of numbers on the individual bars Can we implement the low quality flags to delete posts after a certain number of flags? Can we implement the low quality flag to be like the abuse or spam flags. So if a certain number of low quality flags are made  on a post (whether it be a questions or an answer) the post is deleted?  This would also relieve *close vote and delete vote queues. *which is a much discussed topic.        related: Minimum safe spacing between lava and flamable materials? It seems that containing lava in solid glass, stone and iron blocks may not be sufficient to prevent wool from burning, even if the lava is completely encased.         After some delay, it seems that fire will jump onto the wool above the iron.   Are solid blocks more effective than airspace, or not? If so, Does it matter whether the corner block is filled in? What are the exact rules on distance that I need, and how can I prevent flammable blocks from being eliminated by nearby lava? Bonus: Does a flowing lava block behave differently than a lava source block when it comes to fire creation? "24 hours' notice" or "24 hours notice"? Which one is correct?  1: Well, you canceled on Tuesday and our policy is 24 hours' notice for all cancellations. 2: Well, you canceled on Tuesday and our policy is 24 hours notice for all cancellations.  To me personally, the first one makes more sense grammatically. But I've also heard that the second version is how they typically write it on paper forms at hospitals (that's what native speakers say). Could you please clarify my confusion? How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses? Can we please move the  "Start a bounty" link to be in the same location as all of the other action buttons? It makes no sense to me for this to be buried after the comments - It's an action on the Question. It can be very difficult to locate, especially when your question gets .  I don't think this should be that difficult to implement - it's just moving the location of a design element. Can we please get this button moved? I have an Asus R500VD laptop which came with the preinstalled Windows 8. As actually this computer will be used by my grandmother (and she's only using win 7) I'd like to downgrade it.  Thanks to other thread here, I was able to successfully boot computer from Windows 7 USB stick, but unfortunately during install I got a message:  A required CD/DVD drive device driver is missing. (...)   and I can't get pass it... This is what I've done:   I've downloaded all drivers from Asus Website (), unzip and copied to visible location for windows 7 installation - I've picked each one of them, none has helped. As I belive it's some kind of problem with SATA/RAID/AHCI drivers I went to Intel site and downloaded various "Intel Rapid Storage Technology" drivers - a lot of them were recognized by win7, but none of them helped.   Does anyone have an idea what can I do next? Any help would be really appreciated. In unix/linux, any number of consecutive forwardslashes in a path is generally equivalent to a single forwardslash. eg.  $ cd /home/shum $ pwd /home/shum $ cd /home//shum $ pwd /home/shum $ cd /home///shum $ pwd /home/shum   Yet for some reason two forwardslashes at the beginning of an absolute path is treated specially. eg.  $ cd ////home $ pwd /home $ cd /// $ pwd / $ cd // $ pwd // $ cd home//shum $ pwd //home/shum   Any other number of consecutive forwardslashes anywhere else in a patch gets truncated, but two at the beginning will remain, even if you then navigate around the filesystem relative to it.  Why is this? Is there any difference between /... and //... ? What does the [Flags] Enum Attribute mean in C#? How to clear the interpreter console? Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir() stuff, help() stuff, etc.  Like any console, after a while the visible backlog of past commands and prints gets to be cluttered, and sometimes confusing when re-running the same command several times.  I'm wondering if, and how, to clear the Python interpreter console.  I've heard about doing a system call and either calling cls on Windows or clear on Linux, but I was hoping there was something I could command the interpreter itself to do.  Note: I'm running on Windows, so Ctrl+L doesn't work. I am trying to invite my son (IOS Pocket Edition) to my realms server (mac osx).   I keep getting the response "Could Not Invite The Provided Name" when I try to invite him. His name is all regular characters with no spaces . . . just letters and numbers.  Are the two game types incompatible, and if they are Is it possible to create the same type of 24/7 available server that is only open to him and other invitees like the OSX realms?   Thanks in advance for any clarification. Implementing INotifyPropertyChanged - does a better way exist? Composite primary key from multiple tables / multiple foreign keys I want to build a composite primary key made up of foreign keys from two different tables. I'm still pretty green to this...  A great answer was given to building a composite key from multiple foreign keys on  but I want to do this from multiple tables. I am using Oracle 11g.  foreign key (Name, BoughtFrom, TimeBought)    references the_other_table_name (Name, BoughtFrom, TimeBought)   Imagine that the "references" line actually includes multiple tables. I'm not even sure that the above syntax will work with Oracle.  I have one table "Student" and one table "Parent". It is a many-to-many relationship. My association table is named "Relation" and I would like to make a composite primary key from "PAR_ID" and "STU_ID". Both are foreign keys. Redirect www to non-www using Apache htaccess does not work Is it possible for a familiar to attune to and then wear or wield a magic item? Is it really impossible to calculate in advance the result of throwing dice? Most simple code to populate JTable from ResultSet