problem in compairing 2 strings
<p>I have a problem in comparing 2 string when I use if-else condition. I have value in ss="failure" and I compare it with s1 for executing if and else block, but it goes to else condition. Also why when condition is satisfied in "if" block. Why? Thanks in advanse. {ls explain in details. I am new in java and android. Pls, thanks in advance.</p>

<pre><code>    public class cabbookingconfirmation extends Activity 
    {

        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.cabbbookingconfirmation);
           String ss= Activity1.getData();
           String s1="failure";
           Log.i("tag..........",ss);
           if (ss.equals(s1))
            {
                 Log.i("saurabh..........","trivedi....");
            }
            else
            {
            TextView tv = (TextView)findViewById(R.id.details);
            tv.setText("Dear Gaurav....," +
                    "Your cab has been booked. " +
                    "Please refer to your planner " +
                    "for details.Have a safe trip!");
            tv.setBackgroundColor(111);
            }




        }
     }
</code></pre>

<p>activity1.java is below</p>

<pre><code>public class Activity1 extends Activity
{
     public static String getData() {
            String responceid = null;
                        try {


                       URL url = new URL("http://qrrency.com/mobile/j2me/cab/BookCab.php?bookingid=666");

                       BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
                        int m=0;
                        StringBuffer buffer=new StringBuffer();
                         String str1 = " ";
                        while ((m=in.read())!=-1) 
                        {
                                    buffer.append((char)m);
                                    str1=str1+(char)m;
                                    responceid   =str1;


                        }

                      Log.i("Line----saurabh trivedi---,------,,--",responceid );                               

                       in.close();


                        } catch (MalformedURLException e)
                        {
                        } catch (IOException e) 
                        {

                    }


                        return responceid;


   }

    }
</code></pre>
