title: Enforcing terms and condition Agreement in Android?
body: <p>How to enforce terms and condition agreement in Android? I want to do it like this <a href="http://www.droidbin.com/" rel="nofollow noreferrer">http://www.droidbin.com/</a>. You can observe in the given link that upload appears only when checkbox is ticked else it invisible and initially it is invisible.</p>
  
  <p>My login XML:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:tools="http://schemas.android.com/tools"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:background="@drawable/startbg"
                  android:padding="0dip"
                  tools:context=".LoginActivity"&gt;
  
      &lt;LinearLayout
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:layout_centerVertical="true"
              android:orientation="vertical"
              android:paddingLeft="40dp"
              android:paddingRight="40dp"&gt;
  
          &lt;TextView
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="40dp"
                  android:text="Enter your number"
                  android:textAllCaps="true"
                  android:id="@+id/textView" android:layout_gravity="center_horizontal"
                  android:textColor="@color/sinch_purple" android:textSize="20sp"/&gt;
          &lt;EditText
                  android:id="@+id/loginNo"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="8dp"
                  android:inputType="phone"
                  android:digits="0123456789"
                  android:maxLength="10"
                  android:textSize="32sp"
                  android:padding="10dp"
                  android:textColor="@color/sinch_purple"
                  android:background="@drawable/inputbox"&gt;
  
  
              &lt;requestFocus/&gt;
          &lt;/EditText&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;Button
              android:id="@+id/loginButton"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginBottom="40dp"
              android:layout_gravity="center_horizontal"
              android:background="@drawable/button_login"
              android:minHeight="56dp"
              android:minWidth="132dp"
              android:textColor="@color/off_white"
              android:textSize="22sp"
              android:visibility="invisible"
              android:textStyle="bold" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"/&gt;
  
      &lt;CheckBox
          android:id="@+id/checkBox1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_marginBottom="10dp"
          android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"/&gt;
      &lt;TextView
          android:id="@+id/terms"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textColor="@color/sinch_purple"
          android:layout_toRightOf="@id/checkBox1"
          android:layout_alignTop="@id/checkBox1"
          android:textSize="16sp"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Login Java file </p>
  
  <pre><code> protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          mBox = (CheckBox)findViewById(R.id.checkBox1);
          setContentView(R.layout.login);
          String checkBoxText = "I agree to all the &lt;a href='http://www.redbus.in/mob/mTerms.aspx' &gt; Terms and Conditions&lt;/a&gt;";
  
          mBox.setText(Html.fromHtml(checkBoxText));
          mBox.setMovementMethod(LinkMovementMethod.getInstance());
  
          //terms=(TextView)findViewById(R.id.terms);
          mLoginNo = (EditText) findViewById(R.id.loginNo);
  
          mLoginButton = (Button) findViewById(R.id.loginButton);
          mLoginButton.setEnabled(false);
          mLoginButton.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  loginClicked();
              }
          });
          mBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener()
          {
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
              {
                  if ( mBox.isChecked() )
                  {
                      mLoginButton.setVisibility(buttonView.VISIBLE);
                  }
                  else{
                      mLoginButton.setVisibility(buttonView.GONE);
                     // terms.setText("Please Agree to Terms And Condition");
                  }
              }
          });
      }
  </code></pre>