bmob個人失物應用_app開發模板
該源碼功能上非常單一,但請從源碼封裝及架構的角度來看待。上傳此源碼主要有兩點目的:一、學習并體驗Bmob云存儲二、站在架構的角度,學習Android平臺下app開發過程中的整合【封裝】
源碼簡介
該源碼功能上非常單一,但請從源碼封裝及架構的角度來看待。
上傳此源碼主要有兩點目的:
一、學習并體驗Bmob云存儲
二、站在架構的角度,學習Android平臺下app開發過程中的整合【封裝】
源碼運行截圖
源碼片段
源碼鏈接:http://down.51cto.com/data/1968339
- /**
- * 查詢全部失物信息 queryLosts
- *
- * @return void
- * @throws
- */
- private void queryLosts() {
- showView();
- BmobQuery<lost> query = new BmobQuery<lost>();
- query.order("-createdAt");// 按照時間降序
- query.findObjects(this, new FindListener<lost>() {
- @Override
- public void onSuccess(List<lost> losts) {
- // TODO Auto-generated method stub
- LostAdapter.clear();
- FoundAdapter.clear();
- if (losts == null || losts.size() == 0) {
- showErrorView(0);
- LostAdapter.notifyDataSetChanged();
- return;
- }
- progress.setVisibility(View.GONE);
- LostAdapter.addAll(losts);
- listview.setAdapter(LostAdapter);
- }
- @Override
- public void onError(int code, String arg0) {
- // TODO Auto-generated method stub
- showErrorView(0);
- }
- });
- }
- public void queryFounds() {
- showView();
- BmobQuery<found> query = new BmobQuery<found>();
- query.order("-createdAt");// 按照時間降序
- query.findObjects(this, new FindListener<found>() {
- @Override
- public void onSuccess(List<found> arg0) {
- // TODO Auto-generated method stub
- LostAdapter.clear();
- FoundAdapter.clear();
- if (arg0 == null || arg0.size() == 0) {
- showErrorView(1);
- FoundAdapter.notifyDataSetChanged();
- return;
- }
- FoundAdapter.addAll(arg0);
- listview.setAdapter(FoundAdapter);
- progress.setVisibility(View.GONE);
- }
- @Override
- public void onError(int code, String arg0) {
- // TODO Auto-generated method stub
- showErrorView(1);
- }
- });
- }
- ······
- /**
- * Add links into a TextView.
- * @param viewId The id of the TextView to linkify.
- * @return The BaseAdapterHelper for chaining.
- */
- public BaseAdapterHelper linkify(int viewId) {
- TextView view = retrieveView(viewId);
- Linkify.addLinks(view, Linkify.ALL);
- return this;
- }
- /** Apply the typeface to the given viewId */
- public BaseAdapterHelper setTypeface(int viewId, Typeface typeface) {
- TextView view = retrieveView(viewId);
- view.setTypeface(typeface);
- return this;
- }
- /** Apply the typeface to all the given viewIds */
- public BaseAdapterHelper setTypeface(Typeface typeface, int... viewIds) {
- for (int viewId : viewIds) {
- TextView view = retrieveView(viewId);
- view.setTypeface(typeface);
- }
- return this;
- }
- </found></found></found></found></lost></lost></lost></lost>
責任編輯:chenqingxiang
來源:
網絡整理