diff --git a/bmob_test_pull/AndroidManifest.xml b/bmob_test_pull/AndroidManifest.xml index befb1aa..7098b04 100644 --- a/bmob_test_pull/AndroidManifest.xml +++ b/bmob_test_pull/AndroidManifest.xml @@ -46,6 +46,10 @@ android:name=".FindActivity" android:screenOrientation="portrait"> + + diff --git a/bmob_test_pull/bin/AndroidManifest.xml b/bmob_test_pull/bin/AndroidManifest.xml index befb1aa..7098b04 100644 --- a/bmob_test_pull/bin/AndroidManifest.xml +++ b/bmob_test_pull/bin/AndroidManifest.xml @@ -46,6 +46,10 @@ android:name=".FindActivity" android:screenOrientation="portrait"> + + diff --git a/bmob_test_pull/bin/bmob_test_pull.apk b/bmob_test_pull/bin/bmob_test_pull.apk index 68db6fd..43c7a24 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 8f31883..0eb689b 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/CreateActivity$1.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/CreateActivity$1.class index bd0ba6c..c83bb2a 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/CreateActivity$1.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/CreateActivity$1.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/CreateActivity.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/CreateActivity.class index cb20374..641ba7d 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/CreateActivity.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/CreateActivity.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/FindActivity$1.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/FindActivity$1.class new file mode 100644 index 0000000..ce9a1d0 Binary files /dev/null and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/FindActivity$1.class differ diff --git a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/FindActivity.class b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/FindActivity.class index 357735e..b2d37be 100644 Binary files a/bmob_test_pull/bin/classes/com/example/bmob_test_pull/FindActivity.class and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/FindActivity.class 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 new file mode 100644 index 0000000..923606e Binary files /dev/null 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 new file mode 100644 index 0000000..b24c37e Binary files /dev/null and b/bmob_test_pull/bin/classes/com/example/bmob_test_pull/QueryActivity.class differ diff --git a/bmob_test_pull/bin/resources.ap_ b/bmob_test_pull/bin/resources.ap_ index 701abaa..1d21770 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/src/com/example/bmob_test_pull/CreateActivity.java b/bmob_test_pull/src/com/example/bmob_test_pull/CreateActivity.java index d780941..a8fcb26 100644 --- a/bmob_test_pull/src/com/example/bmob_test_pull/CreateActivity.java +++ b/bmob_test_pull/src/com/example/bmob_test_pull/CreateActivity.java @@ -1,6 +1,7 @@ package com.example.bmob_test_pull; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; @@ -16,7 +17,7 @@ public class CreateActivity extends Activity{ super.onCreate(savedInstanceState); final Person p2 = new Person(); - p2.setName("lucky"); + p2.setName("verylucky"); p2.setAddress("北京东城"); // //final String temid = p2.getObjectId(); @@ -42,10 +43,12 @@ public class CreateActivity extends Activity{ String idget = p2.getObjectId(); toast("what" + idget); + Intent intent =new Intent(CreateActivity.this,FindActivity.class); + startActivity(intent); + } }); - } private void toast(String toast) { diff --git a/bmob_test_pull/src/com/example/bmob_test_pull/FindActivity.java b/bmob_test_pull/src/com/example/bmob_test_pull/FindActivity.java index 00d5aae..28a7450 100644 --- a/bmob_test_pull/src/com/example/bmob_test_pull/FindActivity.java +++ b/bmob_test_pull/src/com/example/bmob_test_pull/FindActivity.java @@ -12,8 +12,10 @@ import cn.bmob.v3.Bmob; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.BmobQuery.CachePolicy; import cn.bmob.v3.listener.FindListener; +import cn.bmob.v3.listener.GetListener; import cn.bmob.v3.listener.SaveListener; import android.app.Activity; +import android.content.Intent; import android.os.Bundle; import com.example.bmob_test_pull.model.Person; @@ -22,37 +24,31 @@ public class FindActivity extends Activity{ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); -// BmobQuery query = new BmobQuery(); -// query.addWhereEqualTo("objectID", shopID); -// query.setCachePolicy(CachePolicy.CACHE_ELSE_NETWORK); // -// // 先从缓存取数据,如果没有,再从网络取。 -// query.setLimit(15); // 限制最多15个结果 -// query.findObjects(this, new FindListener() { -// -// @Override -// public void onSuccess(List goods) { -// // toast("查询商品成功, 共" + goods.size()); -// if (goods.size() == 0) { -// toast("该店还没有添加商品"); -// } -// goodsList = goods; -// goodsListAdapter.refresh(goodsList); -// goodsListAdapter.notifyDataSetChanged(); -// } -// -// @Override -// public void onError(int arg0, String arg1) { -// toast("查询失败"); -// } -// }); -// -// -// -// - - - - - + BmobQuery query = new BmobQuery(); + query.getObject(this, "2b86628bc3", new GetListener() { + + @Override + public void onFailure(int code, String arg0) { + // TODO Auto-generated method stub + toast("查询失败:" + arg0); + } + + @Override + public void onSuccess(Person arg0) { + // TODO Auto-generated method stub + toast("查询成功:" + arg0.getName() + arg0.getAddress()); + Log.i("查询成功:" , arg0.getObjectId() + arg0.getAddress()); + //获得数据的信息 + + Intent intent =new Intent(FindActivity.this,QueryActivity.class); + startActivity(intent); + } + + }); } + + 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/QueryActivity.java b/bmob_test_pull/src/com/example/bmob_test_pull/QueryActivity.java new file mode 100644 index 0000000..9fb85ca --- /dev/null +++ b/bmob_test_pull/src/com/example/bmob_test_pull/QueryActivity.java @@ -0,0 +1,52 @@ +package com.example.bmob_test_pull; + +import java.util.List; + +import android.app.Activity; +import android.os.Bundle; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.widget.Toast; +import cn.bmob.v3.Bmob; +import cn.bmob.v3.BmobQuery; +import cn.bmob.v3.BmobQuery.CachePolicy; +import cn.bmob.v3.listener.FindListener; +import cn.bmob.v3.listener.GetListener; +import cn.bmob.v3.listener.SaveListener; +import android.app.Activity; +import android.os.Bundle; + +import com.example.bmob_test_pull.model.Person; + +public class QueryActivity extends Activity{ + 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); + } + + @Override + public void onSuccess(List arg0) { + // TODO Auto-generated method stub + Log.i("bmob", "成功:" + "共计: " + arg0.size()); + toast("bmobsuccess: " + "共计: " + arg0.size()); + } + }); + } + + private void toast(String toast) { + Toast.makeText(this, toast, Toast.LENGTH_SHORT).show(); + }; + +}