Hi, I'm trying to use the code below to connect to an online source,
then compare the data as it is read line by line against what is typed
in an EditText field before displaying the next page. At the moment
when I run it and press the "Sign In" button nothing happens. The
problem seems to be with the comparison of the data. Can anyone help.

try{

                URL myURL = new URL("http://www.donalokeeffe.com/
usernames.txt");

                URLConnection conn = myURL.openConnection();
                conn.connect();

                BufferedReader is = new BufferedReader(new InputStreamReader
(conn.getInputStream(), "UTF-8"));

                String istr;
                EditText username = (EditText)findViewById(R.id.username2);
                String usrname = username.getText().toString();

                while ((istr = is.readLine()) != null)
                {
                        if(is.readLine() == usrname)
                        {
                                setContentView(R.layout.menu);

                        Button button2 = (Button)findViewById(R.id.timetable);
                    button2.setOnClickListener(mShowttListener);

                    Button button3 = (Button)findViewById(R.id.news);
                    button3.setOnClickListener(mShowlatnewsListener);

                    Button button4 = (Button)findViewById(R.id.lecturer);
                    button4.setOnClickListener(mShowlecturerListener);

                    Button logout = (Button)findViewById(R.id.logout);
                    logout.setOnClickListener(mShowmainListener);

                        }
                }

                }catch ( IOException e )
            {
                Log.d(TAG, "Can not connect to the target server!" );
                try {
                                        throw new IOException();
                                } catch (IOException e1) {
                                        // TODO Auto-generated catch block
                                        e1.printStackTrace();
                                }
            }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to