+ 1
what is name this operation in android studio
boolean checked = ((CheckBox) view).isChecked(); all code public void onCheckboxClicked(View view) { // Is the view now checked? boolean checked = ((CheckBox) view).isChecked(); // Check which checkbox was clicked switch(view.getId()) { case R.id.checkbox_meat: if (checked) // Put some meat on the sandwich else // Remove the meat break; case R.id.checkbox_cheese: if (checked) // Cheese me else // I'm lactose intolerant break; // TODO: Veggie sandwich }
1 ответ
+ 3
view is being converted to a CheckBox object, then you are calling the isChecked() method.
The operation (CheckBox) is called casting. (Or, converting).