android-mesosfer-integration

How to Get All and Query User List Android Mobile Apps in Mesosfer Backend as a Service

This is tutorial about How to Get All and Query User List Android Mobile Apps in Mesosfer Backend as a Service.

Introduction

This Tutorial is the fifth session of Android Mobile Apps series. In this tutorial you will be required some dependency source code you created in the previous session. In this session, we’ll create module to get all and query user list.

Prerequisites

To follow this tutorial, you will need to prepare these items below :

  • Sign up for an account in Mesosfer Backend as a Service.
  • Install latest android studio. In this tutorial, the author used android studio version 2.2.1
  • Download code from previous section.

Getting Started

To show all of users, the first step you have to create new activity (UserListActivity).

how-to-get-all-and-query-user-list-android-apps-in-mesosfer-backend-as-a-service-user-list-activity

Go to layout then change activity_user_list.xml with code below.

In the layout above we define the ListView. The ListView is used to display the user list. You need to add code in UserListActivity to input data into a ListView.

The first step, edit UserListActivity then declare the variable input above method onCreate :

Then in the method onCreate, we need to initialize some of the control that we have indicated above. In addition, you also need to make an adapter for ListView.

Code above is updateAndShowUserList method calls with null parameter values, it means there is no filter in data retrieval. Add the following code to retrieve user data.

You need to make a little change in layout_main.xml, add this code below, put above button log out.

You have to add button user list that navigate to user list page, so you also have to add method handleUserList in MainActivity.

In mobile apps, it will show result as in picture below:

how-to-get-all-and-query-user-list-android-apps-in-mesosfer-backend-as-a-service-user-get-all

Put search button on layout activity_user_list.xml, so you can filter or query data of user list.

how-to-get-all-and-query-user-list-android-apps-in-mesosfer-backend-as-a-service-button-search

Then you need to add method handleSearch on UserListActivity.

After that you can try to insert filter like picture below.

how-to-get-all-and-query-user-list-android-apps-in-mesosfer-backend-as-a-service-filtered

In the code above, you’ve tried to filter firstname, you can custom based on your need.

Everything is done! Download full version code here.

Conclusion

We have created module to get all and query user list. Very simple and quick, isn’t it? Mesosfer helps you connect your project to the cloud. Cut off the development process so you can straight into the delivery process instead stumble on the complicated infrastructure.

Having more than 5 years experience in IT Consultant with the last position as Backend as a Service Developer and has an experience in planning, implementing IT Information System.