bmob personal lost property application_app development template

bmob personal lost property application_app development template

Source code introduction

The source code is very simple in function, but please look at it from the perspective of source code packaging and architecture.

There are two main purposes for uploading this source code:

1. Learn and experience Bmob cloud storage

2. From the perspective of architecture, learn the integration of app development in the Android platform [Packaging]

Source code running screenshot

Source code snippet

  1. /**
  2. * Query all lost property information queryLosts
  3. *
  4. * @return void
  5. * @throws
  6. */  
  7. private   void queryLosts() {
  8. showView();
  9. BmobQuery<lost> query = new BmobQuery<lost>();
  10. query.order( "-createdAt" ); // In descending order of time  
  11. query.findObjects( this , new FindListener<lost>() {
  12.   
  13. @Override  
  14. public   void onSuccess(List<lost> losts) {
  15. // TODO Auto-generated method stub  
  16. LostAdapter.clear();
  17. FoundAdapter.clear();
  18. if (losts == null || losts.size() == 0 ) {
  19. showErrorView( 0 );
  20. LostAdapter.notifyDataSetChanged();
  21. return ;
  22. }
  23. progress.setVisibility(View.GONE);
  24. LostAdapter.addAll(losts);
  25. listview.setAdapter(LostAdapter);
  26. }
  27.   
  28. @Override  
  29. public   void onError( int code, String arg0) {
  30. // TODO Auto-generated method stub  
  31. showErrorView( 0 );
  32. }
  33. });
  34. }
  35.   
  36. public   void queryFounds() {
  37. showView();
  38. BmobQuery<found> query = new BmobQuery<found>();
  39. query.order( "-createdAt" ); // In descending order of time  
  40. query.findObjects( this , new FindListener<found>() {
  41.   
  42. @Override  
  43. public   void onSuccess(List<found> arg0) {
  44. // TODO Auto-generated method stub  
  45. LostAdapter.clear();
  46. FoundAdapter.clear();
  47. if (arg0 == null || arg0.size() == 0 ) {
  48. showErrorView( 1 );
  49. FoundAdapter.notifyDataSetChanged();
  50. return ;
  51. }
  52. FoundAdapter.addAll(arg0);
  53. listview.setAdapter(FoundAdapter);
  54. progress.setVisibility(View.GONE);
  55. }
  56.   
  57. @Override  
  58. public   void onError( int code, String arg0) {
  59. // TODO Auto-generated method stub  
  60. showErrorView( 1 );
  61. }
  62. });
  63. }
  64.   
  65. ······
  66. /**
  67. * Add links into a TextView.
  68. * @param viewId The id of the TextView to linkify.
  69. * @return The BaseAdapterHelper for chaining.
  70. */  
  71. public BaseAdapterHelper linkify( int viewId) {
  72. TextView view = retrieveView(viewId);
  73. Linkify.addLinks(view, Linkify.ALL);
  74. return   this ;
  75. }
  76.   
  77. /** Apply the typeface to the given viewId */  
  78. public BaseAdapterHelper setTypeface( int viewId, Typeface typeface) {
  79. TextView view = retrieveView(viewId);
  80. view.setTypeface(typeface);
  81. return   this ;
  82. }
  83.   
  84. /** Apply the typeface to all the given viewIds */  
  85. public BaseAdapterHelper setTypeface(Typeface typeface, int ... viewIds) {
  86. for ( int viewId : viewIds) {
  87. TextView view = retrieveView(viewId);
  88. view.setTypeface(typeface);
  89. }
  90. return   this ;
  91. }
  92. </found></found></found></found></lost></lost></lost></lost>
Source code link: http://download..com/data/1968339

<<:  Android Pulley

>>:  Android custom ListView to implement contact sorting

Recommend

Many Nobel Prizes are actually related to it! Do you consume enough every day?

Expert of this article: Pa Lize, Chief Physician ...

"There was a cloud made of rain in the wind." What are clouds made of?

Produced by: Science Popularization China Author:...

Web Development Trends in 2015

[[126116]] The Web was originally conceived as a ...

Where will Google take us?

As a winner of Toutiao's Qingyun Plan and Bai...

The latest overseas advertising and marketing methods in 2021

In a blink of an eye, 2020 has passed. This year ...

Baidu Information Flow Platform Advertising Construction Process Guide

This article will tell you about the process of b...

Where should Apple go after the large-screen iPhone?

2014 was a mixed year for Apple . On the one hand...