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

Methods and key points for operating and promoting online activities!

I think the most important thing in the process o...

Wu Zunyou died of pancreatic cancer. How dangerous is this "king of cancer"?

On October 27, Wu Zunyou, a well-known public hea...

How to build a community of 700,000+ from scratch?

The author of this article tries to combine the p...

Why do doctors also think spring is the golden season for growing taller?

Spring is the season for all things to grow, incl...

25 Marketing Operation Experiences That Will Keep Opening Your Mind (Part 1)

There is no standardized perfect solution for mar...