for(int i=0; i<value1; i++) {
addAnsMCQ = new EditText(this);
AnswerRG.addView(addAnsMCQ, 1);
addAnsMCQ.setId(i);
大家好,我开始编写 android 代码并看到了 setId 方法,但是如何获取 id?我使用 findViewById 但不能。请帮帮我谢谢?
我的第二个问题是?按钮创建;
TextView gotAnswer, NoAnsV;
EditText NoQues, NoAnswer;
Integer data[] = new Integer[]{};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.manualask);
NoQues = (EditText) findViewById (R.id.NoQues);
NoAnswer = (EditText) findViewById (R.id.NoAnsw);
create = (Button) findViewById (R.id.create);
create.setOnClickListener(this);
}
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()){
case R.id.create:
Intent intent = new Intent(Manual.this, MCQSample.class);
Bundle b = new Bundle();
data[0] = Integer.parseInt(NoQues.getText().toString());
data[1] = Integer.parseInt(NoAnswer.getText().toString());
b.putIntArray("key", data);
intent.putExtras(b);
startActivity(intent);
finish();
break;
如何放置 putIntArray。我不断收到错误,甚至更改参数 data[] 等。请帮助我