android-mesosfer-integration

How to Add and Delete Data Android Mobile Apps in Mesosfer Backend as a Service

This tutorial is about How to Add and Delete Data Android Mobile Apps in Mesosfer Backend as a Service.

Introduction

This Tutorial is the seventh 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 add and delete data in a Mesosfer Bucket.

Prerequisites

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

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

Getting Started

In previous sessions, we have tried to make the bucket in Mesosfer Backend as a Service and display the data content in Android Apps. Then for the next we will create a function to add and delete data.

Firstly, you have to add a new activity (DataFormActivity) to display a new data input form.

how-to-add-and-delete-data-android-mobile-apps-in-mesosfer-backend-as-a-service-data-form-activity

Go to layout->activity_data_form.xml then add the script below:

Change DataFormActivity then add variable inisialisasai below, put on onCreate method.

Then initiate in method onCreate.

Go to layout and add button in activity_data.xml.

Then change DataActivity, and add method handleAddAnimal and set mode with value FORM_MODE_ADDD.

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

how-to-add-and-delete-data-android-mobile-apps-in-mesosfer-backend-as-a-service-mobile-result2

Then to handle the save button, then DataFormActivity added code below.

Add method to validate.

If the data is valid, execute method saveAnimal.

To ensure that the data you add is working, you need to check into the Mesosfer Backend as a Service.

how-to-add-and-delete-data-android-mobile-apps-in-mesosfer-backend-as-a-service-cloud-result

To delete the data, you simply click on the data line and Add method below. Before define code onItemClick, you need to add menu above method onCreate.

After that put this code below.

confirmation will be shown.

how-to-add-and-delete-data-android-mobile-apps-in-mesosfer-backend-as-a-service-mobile-deletion

Then add method delete Animal, this method will be confirmation when the dialogue is processed.

To ensure that the data you add is working, you need to check into Mesosfer Backend as a Service.

how-to-add-and-delete-data-android-mobile-apps-in-mesosfer-backend-as-a-service-after-deletion

Everything is done! Download full version code here.

Conclusion

We have created module to add and delete data on Mesosfer Bucket. 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.