我对 Android 开发很陌生,我想做的是ArrayList
在TextView
.
我一直在尝试将 转换ArrayList
为Array
,然后将每个项目附加到StringBuilder
. 但是,StringBuilder
似乎不允许我Object
从Array
. 谁能告诉我为什么,或者实际上提供更好的解决方案?
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
ArrayList<String> temp = new ArrayList<String>();
temp = data.getStringArrayListExtra("intentReturn");
Object obj[] = temp.toArray();
for(int i = 0; i < obj.length; i++){
sBuilder.append((String)obj[i]); //This is the line which crashes the app
if(i < obj.length - 1){
sBuilder.append(", ");
}
}
tvResult.setText(sBuilder.toString());
}
提前谢谢了。