Nirav Dangi
Nirav Dangi

Reputation: 3647

Checkbox's Text click Events

I am using checkbox for the purpose of checking "Term & Condications".

if user had selected only checkbox (Square icon) that means terms are accepted and if not then terms are not accepted, but if user clicks on that checkbox's text then i should be able to view "terms & condications" page.

Thanks.

Upvotes: 0

Views: 1348

Answers (2)

Zwiebel
Zwiebel

Reputation: 1615

I don't know exactly what you want but you can do it with the checkbox. You need to create your checkbox and then you can check if checkbox is checked or not.

For example:

 final CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_id);
         if (checkBox.isChecked()) {
             Toast.makeText(getApplicationContext(), "You accepted the Terms", Toast.LENGTH_SHORT);
}
         else {
             Toast.makeText(getApplicationContext(), "You haven't accepted the Terms", Toast.LENGTH_SHORT);
}

Here is one example, which can help to understand it: http://developer.android.com/reference/android/widget/CheckBox.html

Hope it helps.

Upvotes: 0

Shailendra Singh Rajawat
Shailendra Singh Rajawat

Reputation: 8242

take one checkbox and on Textview(better to use button ) setOnClickListener on textView to show T&C . check ckeckBox status throgh checkbox.ischecked() and work accordingly.

Upvotes: 1

Related Questions