2. MainActivity.java package com.com.myapplication; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.Toast; public class MainActivity extends AppCompatActivity {
}3. activity_main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
</LinearLayout>4. Result on screen You are done. The problem is that Eclipse thinks it's an
1 for a
2 and it doesn't work. How can I fix this? asked Dec 5, 2011 at 14:31 Roman RdgzRoman Rdgz 12.9k42 gold badges134 silver badges208 bronze badges You can do this:
primax79 4282 silver badges14 bronze badges answered Dec 5, 2011 at 14:34 3 you may also go for a simple
3:
answered Dec 5, 2011 at 14:39 2 You get the error because you imported wrong package.You should
4 So the callback should be :
answered Dec 5, 2011 at 14:41 HuangHuang 4,8123 gold badges21 silver badges20 bronze badges 0 Try this:
Hope this helps. Edric 25.3k13 gold badges84 silver badges93 bronze badges answered Dec 5, 2011 at 14:38 oriolponsoriolpons 1,88312 silver badges20 bronze badges Translation of the accepted answer by Chris into Kotlin:
answered Apr 25, 2018 at 13:40 ElletlarElletlar 3,1667 gold badges32 silver badges38 bronze badges 1 try this
answered Dec 5, 2011 at 14:35 confuciusconfucius 13.2k10 gold badges49 silver badges66 bronze badges Change
5 with
6 and then press Ctrl+Shift+O to fix your imports. answered Dec 5, 2011 at 14:34 SERPROSERPRO 10k8 gold badges47 silver badges63 bronze badges You could use this code.
answered Aug 7, 2015 at 14:14 Arun ShankarArun Shankar 6121 gold badge5 silver badges16 bronze badges 1
Kevin Kopf 13.6k14 gold badges51 silver badges67 bronze badges answered Aug 20, 2016 at 7:44 1 If you are looking to do this in Kotlin with the interface implementation.
answered Jul 7, 2019 at 3:38 Gastón SaillénGastón Saillén 12.6k5 gold badges69 silver badges79 bronze badges |