public class MainActivity extends Activity implements SensorEventListener { private SensorManager manager; private Sensor detectorSensor; private Sensor stepCntSensor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); コード
このようなクラスですとactivity_main.xmlを参照していると思うのですが・・・
public class checkbox extends MainActivity implements CheckBox.OnCheckedChangeListener{ private CheckBox checkbox; private TextView textview; private TextView textview2; int a; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); checkbox=(CheckBox)findViewById(R.id.checkbox); textview=(TextView)findViewById(R.id.textview3); textview2=(TextView)findViewById(R.id.textview4) ; checkbox.setOnCheckedChangeListener(this); } コード
こちらのクラスでも同じxmlで実現したいのですがこのようには定義できないものなのでしょうか?
するとしたらどのようにしたら実装できるのでしょうか??
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/01/12 06:53
2017/01/12 06:59
2017/01/12 07:06
2017/01/12 07:21 編集
2017/01/12 07:23
2017/01/12 07:40
2017/01/12 13:37