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

Pain! Pain! Pain! Dinosaurs also suffer from cervical spondylosis?

The huge dinosaur fossil skeletons in the museum ...

iOS 14.5 RC version update: Added unlocking with mask, supports the latest AirTag

After Apple’s 2021 Spring Conference a few days a...

Why is the most peculiar appearance of the Yangtze River at its source?

Branches and roads Beaches The longest river in A...

Top Ten World-West Traffic Tunnels in China

1 The world's longest twin-hole highway tunne...

How much does it cost to customize a flash sale mini program in Wenshan?

How much is the quotation for Wenshan flash sale ...

WeChat Mini Program merchant entry process, how to activate the mini program?

When developing an e-commerce mini program , more...