我在 Parse 中有一个名为 Customer_Information 的表。并且有一个名为用户名的列。我想检索用户名列中的所有值并将其存储到数组中。存储后,我想将其设置为单个文本视图。这可能吗?我试过这段代码,但它有一个错误 ArrayIndexOutOfBounds。
public class Users extends Activity{
private static final String tbname = "Customer_Information";
private static final String uname = "username";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.users);
TextView text = (TextView)findViewById(R.id.text);
ParseQuery query = new ParseQuery(tbname);{
try{
List<ParseObject> test = query.find();
for(int x=0;x<test.size();x++){
String[] str = {test.get(x).getString(uname)};
text.setText("Username: "+str[x]+"\n");
}
}
catch (com.parse.ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}