jeudi 30 juillet 2015

If else condition not working on button click

If i don't use any condition on click to call another Activity then it works, but when i use some condition then its not responding, neither calling if section nor else:

btnUpload.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // uploading the file to server

            try {

                strGetName = pref.getString("key_name", null);
                strGetEmail = pref.getString("key_email", null);

                if (strGetEmail.equals("")&&strGetName.equals("")) {
                    Toast.makeText(UploadActivity.this, "Please create your account first", Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent(UploadActivity.this, BasicActivity.class);
                    startActivity(intent);
                }
                else {
                    new UploadFileToServer().execute();
                }

            } catch (Exception e) {
                // TODO: handle exception
            }
        }
   });

Aucun commentaire:

Enregistrer un commentaire