你有没有像这样初始化解析?
Parse.initialize(_App, key1, key2);
要将您的结果添加到您的 resultView 列表中
public class CopyOfShareActivity extends Activity {
String[] resultsAsString = {""};
ListView listView;
ArrayAdapter<String> adapter;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.search);
adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, resultsAsString);
ParseQuery<ParseObject> query = ParseQuery.getQuery("Testing");
query.whereEqualTo("A","Test1");
query.findInBackground(new FindCallback<ParseObject>(){
public void done(List<ParseObject> resultsList, ParseException e) {
if (e == null) {
resultsAsString = new String[resultsList.size()];
for(int index = 0; index < resultsList.size(); index++){
//.get => .getString
resultsAsString[index] = resultsList.get(index).getString("field you want to display");
}
adapter.notifyDataSetChanged();
} else {
Log.w("Parse query", e.getMessage());
}
}
});
listView = (ListView) findViewById(R.id.ResultView);
listView.setAdapter(adapter);
}
}
这应该做的,我希望这一次!:)
适配器有 android.R.layout.simple_list_item_1
这是 listView 的默认布局。考虑如何设置 listView 的样式。例如,如果您希望它看起来不同,您可以设计自己的布局并将“simple_list_item_1”替换为自定义 ListView 表示的名称!