title: if statement not working on String from SharedPreference( already tried "==" & ".equals" & ".equalsIgnoreCase")
body: <p>I recieved the string from arduino using datagram packet and stored the value in my sharedpreference with variable Switch1.</p>
  
  <pre><code>byte[] rcvData = new byte[1024];
  DatagramPacket rcvPacket = new DatagramPacket(rcvData, rcvData.length);
  dtSocket.receive(rcvPacket);
  rcvStr = new String(rcvPacket.getData());
  saveStatusPreference(ResId.substring(1), rcvStr);
  </code></pre>
  
  <p>it works fine I recieve whether my pin is on or off and I can retrive my sharedpreference if what the status is because I printed it in an individual textview just to make sure. But still it won't compare and prints me error.</p>
  
  <pre><code>if(Switch1Status.equalsIgnoreCase("ON"))
  {
    Switch1.setBackgroundResource(R.drawable.onleft1);
  }
  else if(Switch1Status.equalsIgnoreCase("OFF"))
  {
   Switch1.setBackgroundResource(R.drawable.offleft1);
  }
  else
  {
   textView.setText("Error");
  }
  </code></pre>
  
  <p>I already tried .equals from "==" because I found out that's wrong when comparing string values. I can't find solution anymore if somebody knows what I'm doing wrong please help me.</p>
  
  <p>Thanks!</p>