title: clicking report activity nothing was happening in android
body: <p>Hi in the below code when clicking the report button not going to login activity even though it's not happening anything.
  In login activity first of all I am checking the login username and password using session object.
  if the username and password working fine and then want to move to next activity.</p>
  
  <p>Can any one help me from this issue.</p>
  
  <p><strong>Mainactivity.java</strong></p>
  
  <pre><code>report1=(TextView)findViewById(R.id.report1);
          report=(ImageView)findViewById(R.id.report);
          report1.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  Intent i=new Intent(getApplicationContext(),Login.class);
                  startActivity(i);
              }
          });
          report.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  Intent i=new Intent(getApplicationContext(),Login.class);
                  startActivity(i);
              }
          });
  </code></pre>
  
  <p>In the below when I am putting comment for session then it's moving but after entering the username and password it was showing logcat Admin user found but not going to next activity.it was staying in same activity itself.</p>
  
  <p><strong>update Login</strong></p>
  
  <pre><code>public class Login extends Activity {
  ImageButton login;
  private static final Pattern USERNAME_PATTERN = Pattern
          .compile("[a-zA-Z0-9]{1,250}");
  private static final Pattern PASSWORD_PATTERN = Pattern
          .compile("[a-zA-Z0-9+_.]{4,16}");
  EditText usname,pword,ustype;
  TextView tv,tv1;
  Boolean isInternetPresent = false;
  String username,password;
  HttpPost httppost;
  StringBuffer buffer;
  String queryString;
  String data="";
  int i;
  HttpResponse response;
  HttpClient httpclient;
  CheckBox mCbShowPwd;
  SessionManager session;
   private ProgressDialog progressDialog; 
  
   ConnectionDetector cd;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      this.requestWindowFeature(Window.FEATURE_NO_TITLE);
      setContentView(R.layout.login);
     // session = new SessionManager(getApplicationContext());
     // session.checkLogin();
  
  
     // final HashMap&lt;String, String&gt; user = session.getUserDetails();
  
  
  
      login = (ImageButton)findViewById(R.id.login);  
  
      usname = (EditText)findViewById(R.id.username);
      pword= (EditText)findViewById(R.id.password);
      ustype= (EditText)findViewById(R.id.usertype);
      tv = (TextView)findViewById(R.id.tv);
      tv1 = (TextView)findViewById(R.id.tv1);
      mCbShowPwd = (CheckBox) findViewById(R.id.cbShowPwd);
      cd = new ConnectionDetector(getApplicationContext());
     mCbShowPwd.setOnCheckedChangeListener(new OnCheckedChangeListener() {
  
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
  
              if (!isChecked) {
  
                  pword.setTransformationMethod(PasswordTransformationMethod.getInstance());
              } else {
  
                   pword.setTransformationMethod(HideReturnsTransformationMethod.getInstance());
              }
          }
      });
  
  
     login.setOnClickListener(new OnClickListener() {
         @Override
         public void onClick(View v) {
  
             new LoadViewTask().execute(); 
  
  
  
             isInternetPresent = cd.isConnectingToInternet();
             if (!isInternetPresent) {
                 showAlertDialog(Login.this, "No Internet Connection",
                         "You don't have internet connection.", true);
  
                 return;
  
  
             }
  
             String username = usname.getText().toString();
             String password = pword.getText().toString();
  
            // String name = user.get(SessionManager.KEY_USERNAME);
  
  
                 if (username.equals("")) {
                     Toast.makeText(Login.this, "ENTER USERNAME",
                             Toast.LENGTH_LONG).show();
  
                 }
                 if (password.equals("")) {
                     Toast.makeText(Login.this, "ENTER PASSWORD",
                             Toast.LENGTH_LONG).show();
  
                 }
  
            else if (!CheckUsername(username) &amp;&amp; !CheckPassword(password)){
                     Toast.makeText(Login.this, "ENTER VALID USERNAME &amp; PASSWORD",
                           Toast.LENGTH_LONG).show();
             }
             else{
                 queryString = "username=" + username + "&amp;password="
                          + password ;
                String usertype = DatabaseUtility.executeQueryPhp("login",queryString);
                System.out.print(usertype);
  
          if(usertype.equalsIgnoreCase("Admin user Found")){
              runOnUiThread(new Runnable() {
                  public void run() {
  
                      Toast.makeText(Login.this, "Login Sucess",
                                 Toast.LENGTH_LONG).show();
  
  
                  }
              });
  
  
              Intent in=new Intent(Login.this, Reports.class);
              startActivity(in);
  
          }
  
  
  
          else if(usertype.equalsIgnoreCase("No User Found")){
              runOnUiThread(new Runnable() {
                  public void run() {
  
  
                       tv1.setText("InValid UserName and Password");
  
                  }
  
              });
                      }
  
  
          }
  
         }
  
  
       });
  
  
  
  }
  private class LoadViewTask extends AsyncTask&lt;Void, Integer, Void&gt;  
  {  
      //Before running code in separate thread  
      @Override  
      protected void onPreExecute()  
      {  
           progressDialog = ProgressDialog.show(Login.this,"Loading...",  
                  "Loading application View, please wait...", false, false);  
        progressDialog.show(); 
      }  
  
  
      @Override  
      protected Void doInBackground(Void... params)  
      {  
  
          try  
          {  
  
              synchronized (this)  
              {  
  
                  int counter = 0;  
  
                  while(counter &lt;= 4)  
                  {  
  
                      this.wait(850);  
  
                      counter++;  
  
                      publishProgress(counter*25);  
                  }  
              }  
          }  
          catch (InterruptedException e)  
          {  
              e.printStackTrace();  
          }  
          return null;  
      }  
  
  
      @Override  
      protected void onProgressUpdate(Integer... values)  
      {  
  
          progressDialog.setProgress(values[0]);  
      }  
  
      @Override  
      protected void onPostExecute(Void result)  
      {  
  
          progressDialog.dismiss();  
  
  
      }  
  
  }  
  
          private boolean CheckPassword(String password) {
  
              return PASSWORD_PATTERN.matcher(password).matches();
          }
  
          private boolean CheckUsername(String username) {
  
              return USERNAME_PATTERN.matcher(username).matches();
          }
          @SuppressWarnings("deprecation")
          public void showAlertDialog(Context context, String title, String message, Boolean status) {
              AlertDialog alertDialog = new AlertDialog.Builder(context).create();
  
  
              alertDialog.setTitle(title);
  
  
              alertDialog.setMessage(message);
  
  
              alertDialog.setIcon((status) ? R.drawable.success : R.drawable.fail);
  
  
              alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int which) {
                  }
              });
  
  
              alertDialog.show();
          }
  
  }
  </code></pre>