public void onClick(View v) {
BmobQuery query = new BmobQuery();
query.findObjects(Main.this, new FindListener() {
@Override
public void onSuccess(List arg0) {
//这里的数据该怎么添加到listview上,本人新手,最好详细一些
}
http://www.eoeandroid.com/thread-573909-1-1.html?_dsign=4af1e42c
public class DatabaseUtil {
private static List
listview.setAdapter(new Myadapter());
}else {
ToastUtil.showToast(context,"数据获取失败!");
}
}
});
return list;
}
class Myadapter extends BaseAdapter {
@Override
public int getCount() {
int i;
if (list!=null){
i=list.size();
}else {
i=20;
}
return i;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView=View.inflate(context, R.layout.listview_item,null);
SuperTextView tv = (SuperTextView) convertView.findViewById(R.id.mainpage_item_tv);
if (list!=null){
tv.setLeftTopString(list.get(position).getMName().toString());
tv.setLeftBottomString("菜品价格:¥ "+list.get(position).getMPrice().toString());
}
return convertView;
}
}
}