dimanche 28 janvier 2018

How to call an activity after click checkbox

I'm new in android studio and this is my first time using checkbox.I have a fragment (Auto_Billing_Postpaid_Fragment) and an activity(AutoBillingActivity).I have checkbox with id name "checkbox_auto_billing" in fragment.Supposedly, after click in checkbox,it will open AutoBillingActivity .but after check the box,the activity did not open.I'd followed some similar tutorials but didn't work.What is wrong with my code or anything I missed?

Auto_Billing_Postpaid_Fragment :

@Override
public void onClick(View v) {

    CheckBox checkbox_auto_billing = (CheckBox)v.findViewById(R.id.checkbox_auto_billing);
    Intent intent = new Intent(getActivity(), AutoBillingActivity.class);
    startActivity(intent);
}

AutoBillingActivity :

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_auto_billing);
    Intent intent= getIntent();
}




Aucun commentaire:

Enregistrer un commentaire