diff --git a/bmob_test_pull/bin/bmob_test_pull.apk b/bmob_test_pull/bin/bmob_test_pull.apk index 43c7a24..7febdb6 100644 Binary files a/bmob_test_pull/bin/bmob_test_pull.apk and b/bmob_test_pull/bin/bmob_test_pull.apk differ diff --git a/bmob_test_pull/bin/classes.dex b/bmob_test_pull/bin/classes.dex index 0eb689b..e646e51 100644 Binary files a/bmob_test_pull/bin/classes.dex and b/bmob_test_pull/bin/classes.dex differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity$1.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity$1.class index 923606e..c21849b 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity$1.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity$1.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity.class index b24c37e..2d6d9a5 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$id.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$id.class new file mode 100644 index 0000000..5d6ef06 Binary files /dev/null and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$id.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$layout.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$layout.class index 2b22632..f2cf968 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$layout.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$layout.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$string.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$string.class index b5fc0a3..9d0e82a 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$string.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$string.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$style.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$style.class index bc31a1d..11510aa 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$style.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R$style.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R.class index 4261c28..a90a296 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/R.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/adapter/PersonHolder.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/adapter/PersonHolder.class new file mode 100644 index 0000000..a7f3951 Binary files /dev/null and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/adapter/PersonHolder.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/adapter/QueryAdapter.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/adapter/QueryAdapter.class new file mode 100644 index 0000000..077bc35 Binary files /dev/null and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/adapter/QueryAdapter.class differ diff --git a/bmob_test_pull/bin/resources.ap_ b/bmob_test_pull/bin/resources.ap_ index 1d21770..5f9e81a 100644 Binary files a/bmob_test_pull/bin/resources.ap_ and b/bmob_test_pull/bin/resources.ap_ differ diff --git a/bmob_test_pull/gen/com/example/bmob_test_pull/R.java b/bmob_test_pull/gen/com/example/bmob_test_pull/R.java index 156bee7..2b914cd 100644 --- a/bmob_test_pull/gen/com/example/bmob_test_pull/R.java +++ b/bmob_test_pull/gen/com/example/bmob_test_pull/R.java @@ -13,8 +13,16 @@ public final class R { public static final class drawable { public static final int ic_launcher=0x7f020000; } + public static final class id { + public static final int RelativeLayout1=0x7f060001; + public static final int lv_Personlist=0x7f060000; + public static final int tv_Paddress=0x7f060003; + public static final int tv_Pname=0x7f060002; + } public static final class layout { public static final int activity_main=0x7f030000; + public static final int person_info=0x7f030001; + public static final int person_info_item=0x7f030002; } public static final class string { public static final int app_name=0x7f040000; diff --git a/bmob_test_pull/res/layout/person_info.xml b/bmob_test_pull/res/layout/person_info.xml new file mode 100644 index 0000000..6475964 --- /dev/null +++ b/bmob_test_pull/res/layout/person_info.xml @@ -0,0 +1,17 @@ + + + + + + + + + \ No newline at end of file diff --git a/bmob_test_pull/res/layout/person_info_item.xml b/bmob_test_pull/res/layout/person_info_item.xml new file mode 100644 index 0000000..6914f55 --- /dev/null +++ b/bmob_test_pull/res/layout/person_info_item.xml @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/bmob_test_pull/src/com/example/bmob_test_pull/QueryActivity.java b/bmob_test_pull/src/com/example/bmob_test_pull/QueryActivity.java index 9fb85ca..abf9c72 100644 --- a/bmob_test_pull/src/com/example/bmob_test_pull/QueryActivity.java +++ b/bmob_test_pull/src/com/example/bmob_test_pull/QueryActivity.java @@ -1,5 +1,6 @@ package com.example.bmob_test_pull; +import java.util.ArrayList; import java.util.List; import android.app.Activity; @@ -7,6 +8,8 @@ import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; +import android.widget.GridView; +import android.widget.ListView; import android.widget.Toast; import cn.bmob.v3.Bmob; import cn.bmob.v3.BmobQuery; @@ -17,36 +20,72 @@ import cn.bmob.v3.listener.SaveListener; import android.app.Activity; import android.os.Bundle; -import com.example.bmob_test_pull.model.Person; +import com.example.bmob_test_pull.adapter.QueryAdapter; +import com.example.bmob_test_pull.model.Person; public class QueryActivity extends Activity{ + + private ListView Persons; + private QueryAdapter mPersonListAdapter; + private List mPersonList; + + protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - - BmobQuery query = new BmobQuery(); - query.addWhereEqualTo("address", "北京海淀"); - query.setLimit(50); - //执行查询方法 - query.findObjects(this, new FindListener() { - - @Override - public void onError(int arg0, String arg1) { - // TODO Auto-generated method stub - Log.i("bmob","失败:" + "Code:" + arg0 + "Info:" + arg1); - toast("bmobfailure:" + "Code:" + arg0 + "Info:" + arg1); - } + setContentView(R.layout.person_info); - @Override - public void onSuccess(List arg0) { - // TODO Auto-generated method stub - Log.i("bmob", "成功:" + "共计: " + arg0.size()); - toast("bmobsuccess: " + "共计: " + arg0.size()); - } - }); + initView(); + initData(); + } - private void toast(String toast) { - Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); - }; + private void initData() { + // TODO Auto-generated method stub + + + BmobQuery query = new BmobQuery(); + query.addWhereEqualTo("address", "北京海淀"); + query.setLimit(50); + //执行查询方法 + query.findObjects(this, new FindListener() { + + @Override + public void onError(int arg0, String arg1) { + // TODO Auto-generated method stub + Log.i("bmob","失败:" + "Code:" + arg0 + "Info:" + arg1); + toast("bmobfailure:" + "Code:" + arg0 + "Info:" + arg1); + } + + @Override + public void onSuccess(List arg0) { + // TODO Auto-generated method stub + Log.i("bmob", "成功:" + "共计: " + arg0.size()); + toast("bmobsuccess: " + "共计: " + arg0.size()); + + mPersonList = arg0; + mPersonListAdapter.refresh(mPersonList); + mPersonListAdapter.notifyDataSetChanged(); + } + }); + + + } + + private void initView() { + // TODO Auto-generated method stub + Persons = (ListView) findViewById(R.id.lv_Personlist); + + mPersonList = new ArrayList(); + mPersonListAdapter = new QueryAdapter(this, mPersonList); + + Persons.setAdapter(mPersonListAdapter); + //Persons.setOnItemClickListener(this); + + } + + + private void toast(String toast) { + Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); + }; } diff --git a/bmob_test_pull/src/com/example/bmob_test_pull/adapter/PersonHolder.java b/bmob_test_pull/src/com/example/bmob_test_pull/adapter/PersonHolder.java new file mode 100644 index 0000000..3d597d4 --- /dev/null +++ b/bmob_test_pull/src/com/example/bmob_test_pull/adapter/PersonHolder.java @@ -0,0 +1,10 @@ +package com.example.bmob_test_pull.adapter; + +import android.widget.TextView; + +public class PersonHolder { + + public TextView pName; //商品名称 + public TextView pAddress; //商品单价 + +} \ No newline at end of file diff --git a/bmob_test_pull/src/com/example/bmob_test_pull/adapter/QueryAdapter.java b/bmob_test_pull/src/com/example/bmob_test_pull/adapter/QueryAdapter.java new file mode 100644 index 0000000..6920326 --- /dev/null +++ b/bmob_test_pull/src/com/example/bmob_test_pull/adapter/QueryAdapter.java @@ -0,0 +1,74 @@ +package com.example.bmob_test_pull.adapter; + +import java.util.List; + +import com.example.bmob_test_pull.model.Person; +import com.example.bmob_test_pull.R; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +public class QueryAdapter extends BaseAdapter{ + + private Context mContext; + private List mPersonList; + private LayoutInflater mInflater = null; + + public QueryAdapter(Context context, List PersonList) { + mContext = context; + mPersonList = PersonList; + mInflater = LayoutInflater.from(context); + } + + + @Override + public int getCount() { + // TODO Auto-generated method stub + return mPersonList.size(); + } + + @Override + public Object getItem(int position) { + // TODO Auto-generated method stub + return mPersonList.get(position); + } + + @Override + public long getItemId(int position) { + // TODO Auto-generated method stub + return position; + } + + // 刷新列表中的数据 + public void refresh(List list) { + mPersonList = list; + notifyDataSetChanged(); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + // TODO Auto-generated method stub + PersonHolder personholder; + if (convertView == null) { + convertView = mInflater.inflate(R.layout.person_info_item, null); + personholder = new PersonHolder(); + personholder.pName = (TextView) convertView + .findViewById(R.id.tv_Pname); + personholder.pAddress = (TextView) convertView + .findViewById(R.id.tv_Paddress); + convertView.setTag(personholder); + } else { + personholder = (PersonHolder) convertView.getTag(); + } + personholder.pName.setText(mPersonList.get(position).getName()); + personholder.pAddress.setText(mPersonList.get(position).getAddress()); + return convertView; + + } + + +} diff --git a/readme.txt b/readme.txt index 61330a4..2c52cff 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,6 @@ 1. bmob_test_pull̨´1 2. Shop С 3. ĵУĵprojectproject - 19:41 2016/8/18 \ No newline at end of file + 19:41 2016/8/18 +4. bmob_test_pullƶʾ1ɹ + 13:16 2016/8/19 \ No newline at end of file diff --git a/test2.txt b/test2.txt deleted file mode 100644 index 3af2c47..0000000 --- a/test2.txt +++ /dev/null @@ -1,2 +0,0 @@ -add SourceCode -8:20 2016/8/18 \ No newline at end of file