title: Android: Prevent go to next activity when there's no image at ImageView
body: <p>I created an app that required a user to snap a photo and save it to the MySQL database. There are 3 buttons it that activity which is "Camera", "Save", and "Next". Currently, if there's no photo at ImageView, user can still go to the next activity if they click "Next" button. </p>
  
  <p>Now, how I want to make sure that the user cannot go to the next activity if there's no image in ImageView. Below is my code:</p>
  
  <pre><code>    btnNext.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              if(taskClass.getPhoto_before() != null){
  
                  Intent intent = new Intent(TaskUpdateBefore.this, TaskUpdateAfter.class);
                  intent.putExtra("task", taskClass);
                  startActivity(intent);
  
              }else{
  
                  Toast toast = Toast.makeText(TaskUpdateBefore.this,"Please snap a photo and save", Toast.LENGTH_LONG);
  
                  toast.setGravity(Gravity.CENTER, 0, 0);
                  toast.getView().setBackgroundColor(Color.TRANSPARENT);
                  TextView alert = toast.getView().findViewById(android.R.id.message);
                  alert.setTextColor(Color.rgb(213, 56, 23));
                  alert.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 25);
                  alert.setTypeface(null, Typeface.BOLD);
                  alert.setGravity(Gravity.CENTER);
                  toast.show();
  
              }
          }
      });
  </code></pre>
  
  <p>Can anyone knows what is the problem?</p>