Sie sind auf Seite 1von 51

User Modules

Here an android application is developed for consumers, so that they can login to it using a
consumer id and password provided by the administrator. The Consumer can request the
meter readings by simply pressing a button and capturing image in the android application.
The bill amount to be paid for power consumption is automatically generated in the App. The
consumer is provided with the facility to remote disconnect and reconnect to mains. Another
feature is that; the consumer can make the online payment of electricity bill through the App.

Server Module

Energy provider side is a web portal where the administrator can add users, update cost per
unit, filter unpaid users, cut the power supply. The administrator assigns a user id and pass-
word for the user for accessing the mobile application. The readings from the energy meter
will be updated in the energy provider server with the help of user module. After generating
bills, the admin can see the users with payment status. If they are not paid, then the
administrator can disconnect the power supply to the corresponding user by sending
Messages to the energy meter.

Bill Generation

The system designed reduces the efforts of manual data collection of energy meter. Also, data
which is received at service provider side is easy to manipulate for bill generation and other
such tasks. With this system we can collect the reading as well as control the supply to the
user. With addition of software at service provider side, the customer can be informed of
current meter reading, bill for current cycle, status of the line and other parameters to the
customer with message. The technology used in energy meter is expanding to the power
distribution transformers. So that we can cut the power supply from anywhere in case of any
emergency or maintenance, find areas with power distribution failure.
Architecture

Data Flow Diagram


Use Case Diagram
Class Diagram
Sequence Diagram
Activity Diagram
E – R Diagram
package com.example.smartmeter.ui.activity;

import android.app.Dialog;

import android.content.Context;

import android.content.Intent;

import android.content.SharedPreferences;

import android.content.pm.PackageManager;

import android.graphics.Bitmap;

import android.graphics.Color;

import android.graphics.Paint;

import android.os.Bundle;

import android.os.Handler;

import android.support.design.widget.TextInputLayout;

import android.support.v7.app.AppCompatActivity;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.ImageView;

import android.widget.LinearLayout;

import android.widget.TextView;

import com.example.smartmeter.R;

import com.example.smartmeter.model.UserData;
import com.example.smartmeter.utils.CommonUtils;

import com.example.smartmeter.utils.DatabaseUtils;

import com.example.smartmeter.utils.LogUtils;

import com.example.smartmeter.utils.PreferenceUtils;

import com.google.firebase.database.DataSnapshot;

import com.google.firebase.database.DatabaseError;

import com.google.firebase.database.DatabaseReference;

import com.google.firebase.database.FirebaseDatabase;

import com.google.firebase.database.Query;

import com.google.firebase.database.ValueEventListener;

import butterknife.BindView;

import butterknife.ButterKnife;

public class LoginScreen extends AppCompatActivity {

@BindView(R.id.til_username)

TextInputLayout til_username;

@BindView(R.id.til_password)

TextInputLayout til_password;

@BindView(R.id.ed_username)

EditText ed_user_name;

@BindView(R.id.ed_password)
EditText ed_password;

@BindView(R.id.btn_login)

Button btn_login;

@BindView(R.id.llay_forget_password)

LinearLayout llay_forget_password;

@BindView(R.id.llay_register)

LinearLayout llay_register;

@BindView(R.id.tv_new_user)

TextView tv_new_user;

@BindView(R.id.tv_user)

TextView tv_user;

@BindView(R.id.iv_sign)

ImageView iv_sign;

@BindView(R.id.tv_logo_instruction)

TextView tv_logo_instruction;

@BindView(R.id.llay_admin)

LinearLayout llay_admin;

Dialog dialog;
int REQUEST_PERMISSION_CAMERA=1;

public static final int REQUEST_CODE_SCAN = 1;

Context context;

SharedPreferences prefs;

FirebaseDatabase database;

Bitmap bmSelected;

private static final int USER_LOGIN=1,ADMIN_LOGIN=2;

int LOGIN_TYPE=USER_LOGIN;

Handler hh=new Handler();

String strErrorMsg="";

String strSelectedQRCode="";

@Override

protected void onCreate(Bundle savedInstanceState) {


super.onCreate(savedInstanceState);

setContentView(R.layout.activity_login_screen);

try{

getSupportActionBar().hide();

ButterKnife.bind(this);

context = this;

prefs = getSharedPreferences(PreferenceUtils.PREF_NAME, MODE_PRIVATE);

database = FirebaseDatabase.getInstance();

LogUtils.i("Intent","Intent Action Login : "+getIntent().getAction()+" category :


"+getIntent().getCategories()+"data : "+getIntent().getData());

tv_new_user.setPaintFlags(tv_new_user.getPaintFlags() |
Paint.UNDERLINE_TEXT_FLAG);

// til_username.setVisibility(View.GONE);

// til_password.setVisibility(View.VISIBLE);
btn_login.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

try{

if(LOGIN_TYPE==USER_LOGIN){

// String strUserName = ed_user_name.getText().toString().trim();

String strPassword = ed_password.getText().toString().trim();

if (strSelectedQRCode.length()== 10 &&strPassword.length()>0 ) {

loginRequest(strSelectedQRCode, strPassword);

} else {

// if(selectedUri==null){

// tv_logo_instruction.setVisibility(View.VISIBLE);

// tv_logo_instruction.setText("Scan QR Code");

// tv_logo_instruction.setTextColor(Color.RED);

// }
if (strSelectedQRCode.length() !=10) {

tv_user.setText("Select valid qr code");

tv_user.setTextColor(Color.RED);

if (strPassword.length() == 0) {

til_password.setError(getResources().getString(R.string.empty_validation_fiel
d));

}else{

String strUserName = ed_user_name.getText().toString().trim();

String strPassword = ed_password.getText().toString().trim();

if (strUserName.length() > 0&& strPassword.length()>0) {

if(strUserName.equals("admin")&&strPassword.equals("admin@123")){

PreferenceUtils.saveBoolean(PreferenceUtils.LOGIN_STATUS,true,pref
s);

PreferenceUtils.saveText(PreferenceUtils.USER_ID,"admin",prefs);

PreferenceUtils.saveText(PreferenceUtils.USER_CODE,"admin",prefs);

PreferenceUtils.saveText(PreferenceUtils.USER_NAME,"Admin",prefs);

String
strFcmToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);

sendFCMToken(strFcmToken,"admin");
CommonUtils.goNextScreen(LoginScreen.this, HomeScreen.class);

finish();

}else{

CommonUtils.showErrorToast(getResources().getString(R.string.invalid
Credentials),context);

} else {

if (strUserName.length() ==0) {

til_username.setError(getResources().getString(R.string.empty_validation_f
ield));

if (strPassword.length() == 0) {

til_password.setError(getResources().getString(R.string.empty_validation_fiel
d));

}catch (Exception e){


LogUtils.printException(e);

});

iv_sign.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

try{

goScanScreen();

}catch (Exception e){

LogUtils.printException(e);

});

llay_admin.setOnClickListener(new View.OnClickListener() {
@Override

public void onClick(View view) {

try{

LOGIN_TYPE=ADMIN_LOGIN;

iv_sign.setVisibility(View.GONE);

tv_user.setVisibility(View.GONE);

tv_logo_instruction.setVisibility(View.GONE);

til_password.setVisibility(View.VISIBLE);

til_username.setVisibility(View.VISIBLE);

til_username.setHint("User name");

ed_user_name.setHint("User name");

}catch (Exception e){

LogUtils.printException(e);

}
}

});

// llay_forget_password.setOnClickListener(new View.OnClickListener() {

// @Override

// public void onClick(View view) {

// try{

// CommonUtils.goNextScreen(LoginScreen.this, ForgetPasswordScreen.class);

// }catch (Exception e){

// LogUtils.printException(e);

// }

//

// }

// });

llay_register.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

try{

Intent i=new Intent(LoginScreen.this,RegistrationScreen.class);


startActivity(i);

}catch (Exception e){

LogUtils.printException(e);

});

boolean isLogin=prefs.getBoolean(PreferenceUtils.LOGIN_STATUS,false);

if(isLogin){

String nUserType=prefs.getString(PreferenceUtils.USER_TYPE,null);

CommonUtils.goNextScreen(LoginScreen.this,HomeScreen.class);

finish();

}catch (Exception e){

LogUtils.printException(e);

}
private void goScanScreen(){

try {

boolean isGranted = CommonUtils.isCameraPermissionGranted(context,


REQUEST_PERMISSION_CAMERA);

if(isGranted){

strSelectedQRCode="";

Intent i=new Intent(LoginScreen.this, ScannedBarcodeActivity.class);

startActivityForResult(i, REQUEST_CODE_SCAN);

}catch (Exception e){

LogUtils.printException(e);

/**

* This method is used to send login request

* @param strUsername User name

* @param strPassword Password

*/

private void loginRequest(final String strUsername, final String strPassword){


try{

DatabaseReference myRef = database.getReference(DatabaseUtils.TBL_USER);

CommonUtils.showProgress(context);

Query query=myRef.orderByChild("mobile").equalTo(strUsername);

query.addListenerForSingleValueEvent(new ValueEventListener() {

@Override

public void onDataChange(DataSnapshot dataSnapshot) {

CommonUtils.hideProgress();

if (dataSnapshot.exists()) {

// dataSnapshot is the "issue" node with all children with id 0

for (DataSnapshot issue : dataSnapshot.getChildren()) {

final UserData bd = issue.getValue(UserData.class);

if(bd!=null){

if(bd.getMobile().equals(strUsername)&&bd.getPassword().equals(strPas
sword)){
try {

PreferenceUtils.saveBoolean(PreferenceUtils.LOGIN_STATUS,true
,prefs);

PreferenceUtils.saveText(PreferenceUtils.USER_ID,bd.getId(),prefs
);

PreferenceUtils.saveText(PreferenceUtils.USER_CODE,strUsernam
e,prefs);

PreferenceUtils.saveText(PreferenceUtils.USER_NAME,bd.getNam
e(),prefs);

PreferenceUtils.saveText(PreferenceUtils.ACCOUNT,
bd.getAccount(),prefs);

if(!bd.getId().equals("admin")){

String
strFcmToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);

sendFCMToken(strFcmToken,bd.getId());

CommonUtils.hideProgress();

CommonUtils.goNextScreen(LoginScreen.this, HomeScreen.class);

finish();
} catch(Exception e) {

LogUtils.printException(e);

}else{

CommonUtils.showErrorToast(getResources().getString(R.string.inval
idCredentials),context);

}else{

CommonUtils.showErrorToast(getResources().getString(R.string.invalid
Credentials),context);

}else{

CommonUtils.showErrorToast(getResources().getString(R.string.invalidCrede
ntials),context);

@Override

public void onCancelled(DatabaseError databaseError) {

});
// Firebase ref = myRef.child(Firebas.CHILD_FLIGHTS);

// Query queryRef = ref.orderByChild("arrivalDate_code").equalTo("2016-06-


21_GOT");

// queryRef.addListenerForSingleValueEvent(new ValueEventListener() {

// @Override

// public void onDataChange(DataSnapshot dataSnapshot) {

//

// }

// });

// myRef.addValueEventListener(new ValueEventListener() {

// @Override

// public void onDataChange(DataSnapshot dataSnapshot) {

// CommonUtils.hideProgress();

// UserData bd = dataSnapshot.getValue(UserData.class);

//

// }

//

// @Override

// public void onCancelled(DatabaseError error) {


// CommonUtils.hideProgress();

// // Failed to read value

// LogUtils.e("DBError", "Error.....");

// }

// });

}catch (Exception e){

LogUtils.printException(e);

private double getComparision(){

// try{

// BufferedImage imgA = null;

// BufferedImage imgB = null;

//

// try

// {

// File fileA = new File("/home / pratik /"+

// " Desktop / image1.jpg");

// File fileB = new File("/home / pratik /"+


// " Desktop / image2.jpg");

//

// imgA = ImageIO.read(fileA);

// imgB = ImageIO.read(fileB);

// }

// catch (IOException e)

// {

// System.out.println(e);

// }

// int width1 = imgA.getWidth();

// int width2 = imgB.getWidth();

// int height1 = imgA.getHeight();

// int height2 = imgB.getHeight();

//

// if ((width1 != width2) || (height1 != height2))

// System.out.println("Error: Images dimensions"+

// " mismatch");

// else

// {

// long difference = 0;

// for (int y = 0; y < height1; y++)

// {

// for (int x = 0; x < width1; x++)


// {

// int rgbA = imgA.getRGB(x, y);

// int rgbB = imgB.getRGB(x, y);

// int redA = (rgbA >> 16) & 0xff;

// int greenA = (rgbA >> 8) & 0xff;

// int blueA = (rgbA) & 0xff;

// int redB = (rgbB >> 16) & 0xff;

// int greenB = (rgbB >> 8) & 0xff;

// int blueB = (rgbB) & 0xff;

// difference += Math.abs(redA - redB);

// difference += Math.abs(greenA - greenB);

// difference += Math.abs(blueA - blueB);

// }

// }

//

// // Total number of red pixels = width * height

// // Total number of blue pixels = width * height

// // Total number of green pixels = width * height

// // So total number of pixels = width * height * 3

// double total_pixels = width1 * height1 * 3;

//

// // Normalizing the value of different pixels

// // for accuracy(average pixels per color


// // component)

// double avg_different_pixels = difference /

// total_pixels;

//

// // There are 255 values of pixels in total

// double percentage = (avg_different_pixels /

// 255) * 100;

//

// System.out.println("Difference Percentage-->" +

// percentage);

// }

//

// }catch (Exception e){

// LogUtils.printException(e);

// }

return 0;

private void sendFCMToken(String fcmtoken, String userId) {

try {

FirebaseDatabase database= FirebaseDatabase.getInstance();


final DatabaseReference myRef =
database.getReference(DatabaseUtils.TBL_USER).child(userId);

myRef.child("fcmToken").setValue(fcmtoken);

}catch (Exception e){

LogUtils.printException(e);

@Override

public void onRequestPermissionsResult(int requestCode, String[] permissions, int[]


grantResults) {

super.onRequestPermissionsResult(requestCode, permissions, grantResults);

try{

if(requestCode==REQUEST_PERMISSION_CAMERA&&grantResults[0]==
PackageManager.PERMISSION_GRANTED){

LogUtils.i("permission","onRequestPermissionsResult permisssion granted...


permission : "+permissions.toString()+" result : "+grantResults.toString());

goScanScreen();

}catch (Exception e){

LogUtils.printException(e);
}

@Override

public void onActivityResult(int requestCode, int resultCode, Intent data)

try {

if (requestCode == REQUEST_CODE_SCAN&&resultCode==RESULT_OK) {

String id=data.getStringExtra("id");

if(id!=null){

strSelectedQRCode=id;

tv_user.setVisibility(View.VISIBLE);

tv_user.setText(strSelectedQRCode);

CommonUtils.showToast(strSelectedQRCode,context);

tv_user.setTextColor(Color.BLACK);

} catch (Exception e) {

LogUtils.printException(e);

}
}

package com.example.smartmeter.ui.activity;

import android.content.Context;

import android.content.SharedPreferences;

import android.os.Bundle;

import android.os.Handler;

import android.support.annotation.NonNull;

import android.support.design.widget.TextInputLayout;

import android.support.v7.app.AppCompatActivity;

import android.text.Editable;

import android.text.TextWatcher;

import android.view.KeyEvent;

import android.view.MenuItem;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import com.example.smartmeter.R;

import com.example.smartmeter.model.UserData;

import com.example.smartmeter.utils.CommonUtils;

import com.example.smartmeter.utils.DatabaseUtils;
import com.example.smartmeter.utils.LogUtils;

import com.example.smartmeter.utils.PreferenceUtils;

import com.google.android.gms.tasks.OnFailureListener;

import com.google.android.gms.tasks.OnSuccessListener;

import com.google.firebase.database.DataSnapshot;

import com.google.firebase.database.DatabaseError;

import com.google.firebase.database.DatabaseReference;

import com.google.firebase.database.FirebaseDatabase;

import com.google.firebase.database.Query;

import com.google.firebase.database.ValueEventListener;

import butterknife.BindView;

import butterknife.ButterKnife;

public class RegistrationScreen extends AppCompatActivity {

Context context;

SharedPreferences prefs;

@BindView(R.id.til_name)

TextInputLayout til_name;

@BindView(R.id.ed_name)

EditText ed_name;
@BindView(R.id.til_mobile)

TextInputLayout til_mobile;

@BindView(R.id.ed_mobile)

EditText ed_mobile;

@BindView(R.id.til_password)

TextInputLayout til_password;

@BindView(R.id.ed_password)

EditText ed_password;

@BindView(R.id.til_id)

TextInputLayout til_id;

@BindView(R.id.ed_id)

EditText ed_id;

@BindView(R.id.btn_register)

Button btnRegister;

FirebaseDatabase database;
int isMobileNumberAvailable=0;

int isAccountAvailable=0;

Handler handler=new Handler();

long createdTime=0;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_registration_screen);

try{

ButterKnife.bind(this);

getSupportActionBar().setDisplayHomeAsUpEnabled(true);

context=this;

prefs=getSharedPreferences(PreferenceUtils.PREF_NAME,MODE_PRIVATE);

database = FirebaseDatabase.getInstance();
getSupportActionBar().setTitle(getResources().getString(R.string.sign_up));

btnRegister.setText(getResources().getString(R.string.sign_up));

btnRegister.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

try{

String strId = ed_id.getText().toString().trim();

String strName = ed_name.getText().toString().trim();

// String strCountryCode = ed_countrycode.getText().toString().trim();

String strMobile = ed_mobile.getText().toString().trim();

String strPassword = ed_password.getText().toString().trim();

if (strId.length()==10&&isAccountAvailable==0&&strName.length() > 0
&& strMobile.length() > 0&&isMobileNumberAvailable==0 && strMobile.length()==10
&&strPassword.length()>0&&CommonUtils.isValidPassword(strPassword)) {

registerRequest(strId,strName,strMobile,strPassword);

} else {

if (strName.length() == 0) {

til_name.setError(getResources().getString(R.string.empty_validation_fie
ld));
}

if (strId.length() != 10) {

til_id.setError(getResources().getString(R.string.id_validation_field));

}else if(isAccountAvailable==1){

til_id.setError(getResources().getString(R.string.alreadyExist));

if (strMobile.length() == 0) {

til_mobile.setError(getResources().getString(R.string.empty_validation_f
ield));

}else if(strMobile.length()!=10 ){

til_mobile.setError(getResources().getString(R.string.valid_mobile));

}else if(isMobileNumberAvailable==1){

til_mobile.setError(getResources().getString(R.string.mobile_already_exi
st));

if (strPassword.length() == 0) {

til_password.setError(getResources().getString(R.string.empty_validation
_field));

}else if(!CommonUtils.isValidPassword(strPassword)){
til_password.setError(getResources().getString(R.string.valid_password_
error));

}catch (Exception e){

LogUtils.printException(e);

});

ed_mobile.addTextChangedListener(new TextWatcher() {

@Override

public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

@Override

public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

if(CommonUtils.isValid(ed_mobile)){
til_mobile.setError(null);

handler.removeCallbacks(runnableMobile);

handler.postDelayed(runnableMobile,CommonUtils.EDITBOX_DELAY);

@Override

public void afterTextChanged(Editable editable) {

});

ed_id.addTextChangedListener(new TextWatcher() {

@Override

public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

@Override

public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

if(CommonUtils.isValid(ed_id)){

til_id.setError(null);

handler.removeCallbacks(runnableAccountId);

handler.postDelayed(runnableAccountId,CommonUtils.EDITBOX_DELAY);

}
}

@Override

public void afterTextChanged(Editable editable) {

});

CommonUtils.initTextChangeEvent(ed_name,til_name);

// CommonUtils.initTextChangeEvent(ed_countrycode,til_countrycode);

CommonUtils.initTextChangeEvent(ed_password,til_password);

}catch (Exception e){

LogUtils.printException(e);

Runnable runnableMobile=new Runnable() {

@Override
public void run() {

try{

String strMobile=ed_mobile.getText().toString().trim();

if(CommonUtils.isValidMobile(strMobile)){

checkMobileNumberExist();

}else{

til_mobile.setError(getResources().getString(R.string.valid_mobile));

}catch (Exception e){

LogUtils.printException(e);

};

Runnable runnableAccountId=new Runnable() {

@Override

public void run() {

try{

String strId=ed_id.getText().toString().trim();

if(strId.length()==10){

checkAccountIdExist();
}else{

til_id.setError(getResources().getString(R.string.id_validation_field));

}catch (Exception e){

LogUtils.printException(e);

};

private void checkMobileNumberExist(){

try {

final String strMobile=ed_mobile.getText().toString().trim();

DatabaseReference myRef = database.getReference(DatabaseUtils.TBL_USER);

isMobileNumberAvailable=0;

Query query=myRef.orderByChild("mobile").equalTo(strMobile);

query.addListenerForSingleValueEvent(new ValueEventListener() {

@Override

public void onDataChange(DataSnapshot dataSnapshot) {

// CommonUtils.hideProgress();
if (dataSnapshot.exists()) {

// dataSnapshot is the "issue" node with all children with id 0

for (DataSnapshot issue : dataSnapshot.getChildren()) {

UserData bd = issue.getValue(UserData.class);

if(bd!=null){

if(bd.getMobile()!=null&&bd.getMobile().equals(strMobile)){

isMobileNumberAvailable=1;

til_mobile.setError(getResources().getString(R.string.mobile_alread
y_exist));

}else{

}else{

}else{
}

@Override

public void onCancelled(DatabaseError databaseError) {

});

} catch (Exception e) {

LogUtils.printException(e);

private void checkAccountIdExist(){

try {

final String strAccountId=ed_id.getText().toString().trim();

DatabaseReference myRef = database.getReference(DatabaseUtils.TBL_USER);

isAccountAvailable=0;
Query query=myRef.orderByChild("account").equalTo(strAccountId);

query.addListenerForSingleValueEvent(new ValueEventListener() {

@Override

public void onDataChange(DataSnapshot dataSnapshot) {

// CommonUtils.hideProgress();

if (dataSnapshot.exists()) {

// dataSnapshot is the "issue" node with all children with id 0

for (DataSnapshot issue : dataSnapshot.getChildren()) {

UserData bd = issue.getValue(UserData.class);

if(bd!=null){

if(bd.getAccount()!=null&&bd.getAccount().equals(strAccountId)){

isAccountAvailable=1;

til_id.setError(getResources().getString(R.string.alreadyExist));

}else{

}else{
}

}else{

@Override

public void onCancelled(DatabaseError databaseError) {

});

} catch (Exception e) {

LogUtils.printException(e);

@Override

public boolean onOptionsItemSelected(MenuItem item) {


switch (item.getItemId()) {

// Respond to the action bar's Up/Home button

case android.R.id.home:

goBack();

return true;

return super.onOptionsItemSelected(item);

/**

* To handle back event

*/

private void goBack(){

try{

finish();

}catch (Exception e){

LogUtils.printException(e);

@Override

public boolean onKeyDown(int keyCode, KeyEvent event) {

try{
if (keyCode == KeyEvent.KEYCODE_BACK) {

goBack();

return true;

}catch (Exception e){

LogUtils.printException(e);

return super.onKeyDown(keyCode, event);

@Override

protected void onPause() {

super.onPause();

@Override

protected void onResume() {

super.onResume();

/**

* This method is used to send user registration request


*/

private void registerRequest(final String strId, String strName, final String strMobile,
String strPwd){

try {

DatabaseReference myRef = database.getReference(DatabaseUtils.TBL_USER);

String id=myRef.push().getKey();

final long modifiedTime= System.currentTimeMillis();

if(createdTime==0){

createdTime=modifiedTime;

String strFCMToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);

UserData bd=new
UserData(id,strId,strName,strMobile,strPwd,strFCMToken,createdTime,modifiedTime);

CommonUtils.showProgress(context);

myRef.child(id).setValue(bd).addOnSuccessListener(new
OnSuccessListener<Void>() {

@Override
public void onSuccess(Void aVoid) {

CommonUtils.hideProgress();

CommonUtils.showSuccessToast(getResources().getString(R.string.saveSuccess
),context);

goBack();

}).addOnFailureListener(new OnFailureListener() {

@Override

public void onFailure(@NonNull Exception e) {

CommonUtils.hideProgress();

});

Das könnte Ihnen auch gefallen