做android 在一个fragment的onCreateView中使用bmob的数据库执行查询 为什么总是先显示test1,再显示test2,没有按照我想顺序
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View messageLayout = inflater.inflate(R.layout.left_dao,
container, false);
BmobQuery<Post> query = new BmobQuery<Post>();
query.addWhereEqualTo("flag", true);
query.setLimit(50);
query.findObjects(this, new FindListener<Post>() {
//查询成功
@Override
public void onSuccess(List<Post> object) {
// TODO Auto-generated method stub
Toast.makeText(getActivity(), "test2", Toast.LENGTH_SHORT).show();
}
//查询失败
@Override
public void onError(int code, String msg) {
// TODO Auto-generated method stub
Toast.makeText(getActivity(), "error", Toast.LENGTH_SHORT).show();
}
});
Toast.makeText(getActivity(), "test1", Toast.LENGTH_SHORT).show();
}