title: How to create a Alert dialog if there has a return data from previous activity to notify the users?
body: <p>I'm trying to add alert dialog to my project to notify the users if there has return data from previous activity, however in my approach the if statement has a problem or something missing , even without return data the alert dialog is always pop up any suggestion or idea will be appreciated.</p>
  
  <pre><code>//This part is my method
  public void dataReceive(){ 
           //requesting data from server
           //adding parameters
           RequestParams params = new RequestParams(); 
           SessionManager sessionManager = new SessionManager(this);
           HashMap&lt;String, String&gt; user = sessionManager.getUserDetails();
          if (user != null) {
              String uid = user.get(SessionManager.USER_ID);
              params.put("user_id", uid);
          }
          try{
              String name = user.get(SessionManager.KEY_NAME);
  
              username = name;
  
          }catch (Exception e){
  
          }
          //This part is my approach 
          Bundle tokens = this.getIntent().getExtras();
          if(tokens != null) {
              final PendingRequestPojo pendingRequestPojo = new PendingRequestPojo();
              responseid = tokens.getString("responseid");
              requestid = tokens.getString("requestid");
              //Toast.makeText(getApplicationContext(), "responseid :" + responseid + "\nrequestid : " +
              //requestid, Toast.LENGTH_SHORT).show();
  
              alert = new AlertDialog.Builder(SplashActivity.this);
              alert.setTitle("ThirdWheel Payment Response");
              alert.setIcon(R.drawable.thinrdwheel_alert);
              alert.setMessage("Your Payment Was Successfull" + " " + username +
                      "Thank you, we Hope you can ride with us Again ");
              alert.setCancelable(true);
              alert.setPositiveButton("Thanks", new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int i) {
                      changement();
                      Updatepayment(pendingRequestPojo.getRide_id(), "PAID");
                  }
              }).show();
  
          }  else {
  
              changement();
          }
      }
  </code></pre>