java - Error: OnCheckedChangeListener cannot be resolved to a type -


I have red lines under setOnCheckedChangeListener and OnCheckedChangeListener. Error message saying: the line multiple markers - is OnCheckedChangedListener can not be solved in a particular type - method setOnCheckedChangedListener (RadioGroup.OnCheckedChangeListener) type RadioGroup logic (New OnCheckedChangeListener (for) {})

  package com.lifematters; Importroid.os.Bundle; Import android App Import android.content.Intent; Import android.view.View; Import android.widget.Button; Import android.widget.RadioButton; Import android.widget.RadioGroup; Import android.widget.Toast; Public Class Test increases activity 1 {@ Override Protected Zero on Crate (Bundle Saved Instantstate) {super.onCreate (savedInstanceState); SetContentView (R.layout.test1); // Define navigation image button last button nextBtn = (button) findViewById (R.id.btnNext); RadioGroup radio group = (radio group) searchVBIID (RID. Radioensor1); Radio Group Kseton checked change Listnr (new on Cheked Change Listnr () {public void (radio group on checkout, IIT examined IID) (Last Rediobutn Redioboton 1 = (radio button) Khojwubiaiaidi (RID. Rediyoa 1); last PushButton RadioButton2 = (radio button) Get UbiID (RIDDradiye 2); Final RadioButton radioButton3 = (RadioButton) findViewById (R.id.radioA3); Final RadioButton radioButton4 = (RadioButton) findViewById (R.id.radioA4); if (radioButton1.isChecked ()) {DisplayToas T ( "No, not at all");} else if (radioButton2.isChecked ()) {DisplayToast ( "a few days");} else if (radioButton3.isChecked ()) {DisplayToast ( "half day" ) But;} else {disestotost ("almost everyday");}}}); }}  

two possibilities:

  • RadioGroup.OnCheckedChangeListener

  • Change the couple to start their classes:

      import android. Widget .RadioGroup.OnCheckedChangeListener;  
      as public void displayToast (String text:  

DisplayToast , add the following } {Toast. Make text (this, text, toast.tost.lnghiharrat). Show (); }

and change DisplayToast to displayToast in your code. Law names should start with a lower-case letter by the convention. Only the class name should start with the upper-case letter.


Comments