我需要在listview中显示这些数据,它是关系数据,我已经知道如何重新出现,我不知道它是如何显示的,我在一个活动中进行。
final ListView listview =(ListView)findViewById(R.id.lvComentario); final String [] [] values = {new String [] {“linda”,“bonita”}};
final ArrayList<String> list = new ArrayList<String>();
for (int i = 0; i < values[0].length; ++i) {
list.add(values[0][i]);
}
final StableArrayAdapter adapter = new StableArrayAdapter(this,
android.R.layout.simple_list_item_1, list);
listview.setAdapter(adapter);
comentario = (EditText) findViewById(R.id.text_comentario);
botaoSalvar = (Button) findViewById(R.id.button_salvar);
Intent i = getIntent();
obID = i.getStringExtra("imagem");
//exibirComentario();
ParseQuery<ParseObject> query = ParseQuery.getQuery("comentario");
query.whereEqualTo("parentesco", obID);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> commentList, ParseException e) {
if (e == null) {
Log.d("score", "no doctor available: ");
} else {
Log.w("Parse query", e.getMessage());
}
adapter.notifyDataSetChanged();
}
});
答案 0 :(得分:0)
您需要在从parse接收数据后设置适配器。
final ListView listview = (ListView) findViewById(R.id.lvComentario);
ParseQuery<ParseObject> query = ParseQuery.getQuery("comentario");
query.whereEqualTo("parentesco", obID);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> commentList, ParseException e) {
if (e == null) {
Log.d("score", "no doctor available: ");
} else {
Log.w("Parse query", e.getMessage());
//Use your custom adapter according to your comment list or design
final StableArrayAdapter adapter = new StableArrayAdapter(this,android.R.layout.simple_list_item_1, commentList);
listview.setAdapter(adapter);
}
}