单击按钮后,我试图将数组的内容复制到另一个数组。我希望 oldArray 在复制到 newArray 后清除以前的数据。我有这个代码,我迷路了。谁能指导我如何做到这一点?这是我到目前为止所拥有的。
final String [] oldArray;
oldArray = new String[5];
oldArray[0] = "c";
oldArray[1] = "h";
oldArray[2] = "a";
oldArray[3] = "r";
oldArray[4] = "m";
for (i = 0; i < 5; i++);
{
oldarrayOut.setText(oldArray[i]);
}
bOk.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String[] newArray = new String[5];
for (i = 0; i < 5; i++);
{
newArray[i] = oldArray[i];
newarrayOut.setText(newArray[i]);
}
}
});
如果我的代码有问题,请随时通知我。非常感谢!