Advertisement
kitlolz012

reservation form (alert)

Nov 27th, 2023
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 25.86 KB | None | 0 0
  1. package com.example.gypsy;
  2.  
  3. import androidx.annotation.NonNull;
  4. import androidx.appcompat.app.AlertDialog;
  5. import androidx.appcompat.app.AppCompatActivity;
  6. import androidx.appcompat.widget.AppCompatButton;
  7.  
  8. import android.app.DatePickerDialog;
  9. import android.content.ClipData;
  10. import android.content.ClipboardManager;
  11. import android.content.Context;
  12. import android.content.DialogInterface;
  13. import android.content.Intent;
  14. import android.net.Uri;
  15. import android.os.AsyncTask;
  16. import android.os.Bundle;
  17. import android.util.Log;
  18. import android.view.View;
  19. import android.widget.ArrayAdapter;
  20. import android.widget.Button;
  21. import android.widget.EditText;
  22. import android.widget.ImageView;
  23. import android.widget.NumberPicker;
  24. import android.widget.ProgressBar;
  25. import android.widget.Spinner;
  26. import android.widget.TextView;
  27. import android.widget.Toast;
  28.  
  29.  
  30. import java.text.ParseException;
  31. import java.text.SimpleDateFormat;
  32. import java.util.ArrayList;
  33. import java.util.Calendar;
  34. import java.util.Date;
  35. import java.util.HashMap;
  36. import java.util.List;
  37. import java.util.Locale;
  38. import java.util.Map;
  39.  
  40.  
  41. import com.google.android.gms.tasks.OnFailureListener;
  42. import com.google.android.gms.tasks.OnSuccessListener;
  43. import com.google.firebase.auth.FirebaseAuth;
  44. import com.google.firebase.auth.FirebaseUser;
  45. import com.google.firebase.database.DataSnapshot;
  46. import com.google.firebase.database.DatabaseError;
  47. import com.google.firebase.database.DatabaseReference;
  48. import com.google.firebase.database.FirebaseDatabase;
  49. import com.google.firebase.database.ServerValue;
  50. import com.google.firebase.database.ValueEventListener;
  51. import com.google.firebase.storage.FirebaseStorage;
  52. import com.google.firebase.storage.StorageReference;
  53. import com.google.firebase.storage.UploadTask;
  54.  
  55. import java.util.ArrayList;
  56. import java.util.Calendar;
  57. import java.util.List;
  58.  
  59. public class ReserveForm extends AppCompatActivity {
  60.  
  61.     private EditText fullNameEditText;
  62.     private EditText contactNumberEditText;
  63.     private EditText emailEditText;
  64.     private EditText reservationDateEditText;
  65.     private DatabaseReference databaseReference;
  66.     private EditText yourGcashNameET;
  67.     private EditText yourGcashNumberET;
  68.     private EditText referenceNumberET;
  69.     private Button submitButton;
  70.     private ImageView attachedImageView;
  71.     private static final int PICK_IMAGE_REQUEST = 1;
  72.     private Uri selectedImageUri;
  73.     Object timestamp;
  74.  
  75.     private TextView customerstv,gcashDepositNumberET, gcashDepositNameET, reservefeeET;
  76.     private int customerCount = 0;
  77.  
  78.     ImageView imageView;
  79.     TextView textView;
  80.  
  81.     @Override
  82.     protected void onCreate(Bundle savedInstanceState) {
  83.         super.onCreate(savedInstanceState);
  84.         setContentView(R.layout.activity_reserve_form);
  85.  
  86.         Intent intent = getIntent();
  87.         String restoId = intent.getStringExtra("restoKey");
  88.         Log.d("ReserveFormActivity", "restoId: " + restoId);
  89.  
  90.         fullNameEditText = findViewById(R.id.fullNameEditText);
  91.         contactNumberEditText = findViewById(R.id.contactNumberEditText);
  92.         emailEditText = findViewById(R.id.emailEditText);
  93.         reservationDateEditText = findViewById(R.id.reservationDateEditText);
  94.         submitButton = findViewById(R.id.submitButton);
  95.         yourGcashNameET = findViewById(R.id.yourGcashNameET);
  96.         yourGcashNumberET = findViewById(R.id.yourGcashNumberET);
  97.         referenceNumberET = findViewById(R.id.referenceNumberET);
  98.         attachedImageView = findViewById(R.id.attachedImageView);
  99.  
  100.         databaseReference = FirebaseDatabase.getInstance().getReference();
  101.  
  102.         customerstv = findViewById(R.id.customerstv);
  103.  
  104.         gcashDepositNumberET = findViewById(R.id.gcashDepositNumberET);
  105.         gcashDepositNameET = findViewById(R.id.gcashDepositNameET);
  106.         reservefeeET= findViewById(R.id.reservefeeET);
  107.  
  108.         imageView = findViewById(R.id.copyImageView);
  109.         textView = findViewById(R.id.gcashDepositNumberET);
  110.  
  111.         AlertDialog alertDialog = showTermsDialog();
  112.         if (alertDialog != null && alertDialog.isShowing()) {
  113.             alertDialog.dismiss();
  114.         }
  115.  
  116.         imageView.setOnClickListener(new View.OnClickListener() {
  117.             @Override
  118.             public void onClick(View v) {
  119.                 ClipboardManager clipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
  120.                 ClipData clipData = ClipData.newPlainText("Copy",textView.getText().toString());
  121.                 clipboardManager.setPrimaryClip(clipData);
  122.                 Toast.makeText(ReserveForm.this, "Copied", Toast.LENGTH_SHORT).show();
  123.             }
  124.         });
  125.  
  126.         DatabaseReference restoRef = databaseReference.child("restaurants").child(restoId);
  127.         restoRef.addListenerForSingleValueEvent(new ValueEventListener() {
  128.             @Override
  129.             public void onDataChange(@NonNull DataSnapshot restoSnapshot) {
  130.                 if (restoSnapshot.exists()) {
  131.                     String gcashNumber = restoSnapshot.child("gcashNumber").getValue(String.class);
  132.                     String gcashName = restoSnapshot.child("gcashName").getValue(String.class);
  133.                     String reservefee = restoSnapshot.child("reservationFee").getValue(String.class);
  134.  
  135.                     if (gcashDepositNameET != null && gcashDepositNumberET != null) {
  136.                         gcashDepositNumberET.setText(gcashNumber);
  137.                         gcashDepositNameET.setText(gcashName);
  138.                         reservefeeET.setText(reservefee);
  139.                     } else {
  140.                         Log.e("BookForm", "gcashDepositNameET or gcashDepositNumberET is null");
  141.                     }
  142.                 } else {
  143.                     Log.e("ReserveForm", "Resto not found with ID: " + restoId);
  144.                 }
  145.             }
  146.  
  147.             @Override
  148.             public void onCancelled(@NonNull DatabaseError databaseError) {
  149.                 Log.e("ReserveForm", "Hotel database error: " + databaseError.getMessage());
  150.             }
  151.         });
  152.  
  153.  
  154.  
  155.         reservationDateEditText.setOnClickListener(new View.OnClickListener() {
  156.             @Override
  157.             public void onClick(View v) {
  158.                 showDatePickerDialog(reservationDateEditText);
  159.             }
  160.         });
  161.  
  162.         submitButton.setOnClickListener(new View.OnClickListener() {
  163.             @Override
  164.             public void onClick(View v) {
  165.                 if (areAllFieldsFilled()) {
  166.                     FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
  167.  
  168.                     if (currentUser != null) {
  169.                         String enteredEmail = emailEditText.getText().toString();
  170.                         String registeredEmail = currentUser.getEmail();
  171.  
  172.                         if (enteredEmail.equals(registeredEmail)) {
  173.                             // Email is correct, continue with the submission
  174.  
  175.                             // Assuming you have a reference to your loadingProgressBar
  176.                             ProgressBar loadingProgressBar = findViewById(R.id.loadingProgressBar);
  177.  
  178.                             // Show loading indicator
  179.                             submitButton.setVisibility(View.GONE);
  180.                             loadingProgressBar.setVisibility(View.VISIBLE);
  181.  
  182.                             new AsyncTask<Void, Void, Void>() {
  183.                                 @Override
  184.                                 protected Void doInBackground(Void... params) {
  185.                                     try {
  186.                                         Thread.sleep(5000); // Simulating a 2-second delay
  187.                                     } catch (InterruptedException e) {
  188.                                         e.printStackTrace();
  189.                                     }
  190.                                     return null;
  191.                                 }
  192.  
  193.                                 @Override
  194.                                 protected void onPostExecute(Void result) {
  195.                                     // After the form submission is complete, hide the loading indicator
  196.                                     loadingProgressBar.setVisibility(View.GONE);
  197.                                     submitButton.setVisibility(View.VISIBLE);
  198.  
  199.  
  200.                                     String userId = currentUser.getUid();
  201.                             String fullName = fullNameEditText.getText().toString();
  202.                             String contactNumber = contactNumberEditText.getText().toString();
  203.                             String reservationDate = reservationDateEditText.getText().toString();
  204.                             int customers = Integer.parseInt(customerstv.getText().toString());
  205.                             String email = emailEditText.getText().toString();
  206.                             String yourGcashName = yourGcashNameET.getText().toString();
  207.                             String yourGcashNumber = yourGcashNumberET.getText().toString();
  208.                             String referenceNumber = referenceNumberET.getText().toString();
  209.  
  210.                             canSubmitBooking(userId, restoId, fullName, reservationDate, contactNumber, email, customers,
  211.                                     yourGcashName, yourGcashNumber, referenceNumber);
  212.  
  213.                                     finish();
  214.                                 }
  215.                             }.execute();
  216.  
  217.                             showProfileCheckAlert();
  218.  
  219.  
  220.  
  221.                         } else {
  222.                              Toast.makeText(ReserveForm.this, "Please enter the email associated with your account.", Toast.LENGTH_SHORT).show();
  223.                         }
  224.                     } else {
  225.                         Log.e("ReserveForm", "User is not authenticated");
  226.                     }
  227.                 } else {
  228.                     Toast.makeText(ReserveForm.this, "All fields are required.", Toast.LENGTH_SHORT).show();
  229.                 }
  230.             }
  231.         });
  232.         Button attachPhotoButton = findViewById(R.id.attachPhotoButton);
  233.         attachPhotoButton.setOnClickListener(new View.OnClickListener() {
  234.             @Override
  235.             public void onClick(View v) {
  236.                 openFileChooser();
  237.             }
  238.         });
  239.  
  240.         TextView termsPaymentTextView = findViewById(R.id.termsPayment);
  241.         termsPaymentTextView.setOnClickListener(new View.OnClickListener() {
  242.             @Override
  243.             public void onClick(View view) {
  244.                 showTermsDialog();
  245.             }
  246.         });
  247.     }
  248.  
  249.  
  250.     public void incrementValue(View view) {
  251.         if (customerCount < 9) {
  252.             customerCount++;
  253.             updateAdultsCount();
  254.         }
  255.     }
  256.  
  257.     public void decrementValue(View view) {
  258.         if (customerCount > 0) {
  259.             customerCount--;
  260.             updateAdultsCount();
  261.         }
  262.     }
  263.  
  264.  
  265.     private void updateAdultsCount() {
  266.         customerstv.setText(String.valueOf(customerCount));
  267.     }
  268.  
  269.  
  270.     private void openFileChooser() {
  271.         Intent intent = new Intent();
  272.         intent.setType("image/*");
  273.         intent.setAction(Intent.ACTION_GET_CONTENT);
  274.         startActivityForResult(intent, PICK_IMAGE_REQUEST);
  275.     }
  276.  
  277.     @Override
  278.     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  279.         super.onActivityResult(requestCode, resultCode, data);
  280.  
  281.         if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
  282.             selectedImageUri = data.getData();
  283.             attachedImageView.setImageURI(selectedImageUri);
  284.             attachedImageView.setVisibility(View.VISIBLE);
  285.         }
  286.     }
  287.  
  288.     private void showProfileCheckAlert() {
  289.         AlertDialog.Builder builder = new AlertDialog.Builder(ReserveForm.this);
  290.         builder.setTitle("Reservation  Submitted");
  291.         //papalitan nalang message kung ano angkop
  292.         builder.setMessage("Your Reservation has been submitted. Please check always your profile for the Reservation status.");
  293.         builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
  294.             public void onClick(DialogInterface dialog, int which) {
  295.                 // Do nothing here as the user will be redirected to the profile
  296.             }
  297.         });
  298.         builder.show();
  299.     }
  300.  
  301.  
  302.     private void canSubmitBooking(String userId, String restoId, String fullName, String reservationDate, String contactNumber, String email, int customers,
  303.                                   String yourGcashName, String yourGcashNumber, String referenceNumber) {
  304.  
  305.         DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
  306.  
  307.         DatabaseReference userreservationsRef = databaseReference.child("reservation_info");
  308.         userreservationsRef.orderByChild("userId").equalTo(userId).addListenerForSingleValueEvent(new ValueEventListener() {
  309.             @Override
  310.             public void onDataChange(DataSnapshot dataSnapshot) {
  311.                 Log.d("Reservation", "Entering canSubmitBooking method");
  312.  
  313.                 boolean canSubmit = true;
  314.                 for (DataSnapshot reservationSnapshot : dataSnapshot.getChildren()) {
  315.                     String existingCheckOutDate = reservationSnapshot.child("reservationDate").getValue(String.class);
  316.  
  317.                     SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
  318.                     Date currentDate = new Date();
  319.                     Date existingCheckOut = null;
  320.  
  321.                     try {
  322.                         existingCheckOut = sdf.parse(existingCheckOutDate);
  323.                     } catch (ParseException e) {
  324.                         e.printStackTrace();
  325.                     }
  326.  
  327.                     Log.d("Reservation", "Existing Checkout Date: " + existingCheckOutDate);
  328.  
  329.                     if (existingCheckOut != null) {
  330.                         if (!(existingCheckOut.before(existingCheckOut)||
  331.                                 existingCheckOut.after(existingCheckOut))) {
  332.                             canSubmit = false;
  333.                             break;
  334.                         }
  335.                         Log.d("Reservation", "Current Date: " + currentDate);
  336.                         Log.d("Reservation", "Existing Checkout Date: " + existingCheckOut);
  337.  
  338.                         if (existingCheckOut != null && currentDate.before(existingCheckOut)) {
  339.                             canSubmit = false;
  340.                             break;
  341.                         }
  342.                     }
  343.                 }
  344.  
  345.                 Log.d("Reservation", "canSubmit: " + canSubmit);
  346.  
  347.                 if (canSubmit) {
  348.                     saveBooking(userId, restoId, fullName, reservationDate, contactNumber, email, customers,
  349.                             yourGcashName, yourGcashNumber, referenceNumber,timestamp);
  350.                 } else {
  351.                     Toast.makeText(ReserveForm.this, "You cannot submit a new Reservation until your current Reservation has ended.", Toast.LENGTH_SHORT).show();
  352.                 }
  353.             }
  354.  
  355.             @Override
  356.             public void onCancelled(DatabaseError databaseError) {
  357.                 Log.e("Reservation", "Database error: " + databaseError.getMessage());
  358.             }
  359.         });
  360.     }
  361.  
  362.  
  363.  
  364.     private void saveBooking (String userId, String restoId, String fullName,String reservationDate, String contactNumber, String email, int customers,
  365.                        String yourGcashName, String yourGcashNumber, String referenceNumber, Object timestamp) {
  366.         FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
  367.  
  368.         if (currentUser != null) {
  369.             String userType = "Tourist";
  370.             String userPath =  "users/" + userType + "/" + currentUser.getUid() + "/name";
  371.             DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
  372.             DatabaseReference userRef = databaseReference.child(userPath);
  373.             userRef.addListenerForSingleValueEvent(new ValueEventListener() {
  374.                 @Override
  375.                 public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  376.                     Log.d("ReserveForm", "onDataChange called");
  377.                     if (dataSnapshot.exists()) {
  378.                         String userName = dataSnapshot.getValue(String.class);
  379.                         Log.d("ReserveForm", "Name retrieved: " + userName);
  380.  
  381.                         DatabaseReference restaurantRef = databaseReference.child("restaurants").child(restoId).child("user_id");
  382.                         Log.d("BookForm", "hrestaurantref: " + restaurantRef);
  383.                         restaurantRef.addListenerForSingleValueEvent(new ValueEventListener() {
  384.                             @Override
  385.                             public void onDataChange(@NonNull DataSnapshot restaurantDataSnapshot) {
  386.                                 if (restaurantDataSnapshot.exists()) {
  387.                                     String restoUserId = restaurantDataSnapshot.getValue(String.class);
  388.                                     Log.d("ReserveForm", "restoUserId: " + restoUserId);
  389.  
  390.                                     if (selectedImageUri != null) {
  391.                                         StorageReference storageReference = FirebaseStorage.getInstance().getReference();
  392.                                         StorageReference imageRef = storageReference.child("payment_receipts/" + userId + "/" + restoId + "/image.jpg");
  393.  
  394.                                         imageRef.putFile(selectedImageUri)
  395.                                                 .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
  396.                                                     @Override
  397.                                                     public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
  398.                                                         imageRef.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
  399.                                                             @Override
  400.                                                             public void onSuccess(Uri downloadUri) {
  401.                                                                 String imageUrl = downloadUri.toString();
  402.  
  403.  
  404.                                                                 DatabaseReference reservationsRef = databaseReference.child("reservation_info").push();
  405.                                                                 String reservationId = reservationsRef.getKey();
  406.  
  407.                                                                 reservationsRef.child("isConfirmed").setValue(false);
  408.                                                                 reservationsRef.child("isPending").setValue(true);
  409.                                                                 reservationsRef.child("isDeclined").setValue(false);
  410.  
  411.                                                                 reservationsRef.child("userId").setValue(userId);
  412.                                                                 reservationsRef.child("fullName").setValue(fullName);
  413.                                                                 reservationsRef.child("reservationDate").setValue(reservationDate);
  414.                                                                 reservationsRef.child("contactNumber").setValue(contactNumber);
  415.                                                                 reservationsRef.child("email").setValue(email);
  416.                                                                 reservationsRef.child("customers").setValue(customers);
  417.                                                                 reservationsRef.child("restoUserId").setValue(restoUserId);
  418.  
  419.                                                                 reservationsRef.child("GcashName").setValue(yourGcashName);
  420.                                                                 reservationsRef.child("yGcashNumber").setValue(yourGcashNumber);
  421.                                                                 reservationsRef.child("referenceNumber").setValue(referenceNumber);
  422.                                                                 reservationsRef.child("imageUrl").setValue(imageUrl);
  423.  
  424.                                                                 reservationsRef.child("timestamp").setValue(ServerValue.TIMESTAMP);
  425.  
  426.                                                                 Log.d("ReservationForm", "Booking data saved");
  427.                                                                 Toast.makeText(ReserveForm.this, "Reservation submitted.", Toast.LENGTH_SHORT).show();
  428.                                                             }
  429.                                                         });
  430.                                                     }
  431.                                                 })
  432.                                                 .addOnFailureListener(new OnFailureListener() {
  433.                                                     @Override
  434.                                                     public void onFailure(@NonNull Exception e) {
  435.                                                         Log.e("BookForm", "Image upload failed: " + e.getMessage());
  436.                                                     }
  437.                                                 });
  438.                                     } else {
  439.                                         Log.e("BookForm", "Selected image URI is null");
  440.                                     }
  441.                                 }
  442.                             }
  443.  
  444.                             @Override
  445.                             public void onCancelled(@NonNull DatabaseError databaseError) {
  446.                                 Log.e("BookForm", "Database error: " + databaseError.getMessage());
  447.                             }
  448.                         });
  449.                     } else {
  450.                         Log.e("BookForm", "User is not authenticated");
  451.                     }
  452.                 }
  453.                 @Override
  454.                 public void onCancelled(@NonNull DatabaseError databaseError) {
  455.                     Log.e("BookForm", "Database error: " + databaseError.getMessage());
  456.                 }
  457.             });
  458.         } else {
  459.             Log.e("BookForm", "User is not authenticated");
  460.         }
  461.     }
  462.     private void showDatePickerDialog(final EditText editText) {
  463.         final Calendar calendar = Calendar.getInstance();
  464.         int year = calendar.get(Calendar.YEAR);
  465.         int month = calendar.get(Calendar.MONTH);
  466.         int dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH);
  467.  
  468.         DatePickerDialog datePickerDialog = new DatePickerDialog(this, new DatePickerDialog.OnDateSetListener() {
  469.             @Override
  470.             public void onDateSet(android.widget.DatePicker view, int year, int monthOfYear, int dayOfMonth) {
  471.                 Calendar selectedCalendar = Calendar.getInstance();
  472.                 selectedCalendar.set(year, monthOfYear, dayOfMonth);
  473.  
  474.                 if (selectedCalendar.before(calendar)) {
  475.                     Toast.makeText(ReserveForm.this, "Please select a future date", Toast.LENGTH_SHORT).show();
  476.                 } else {
  477.                     String selectedDate = (monthOfYear + 1) + "/" + dayOfMonth + "/" + year;
  478.                     editText.setText(selectedDate);
  479.                 }
  480.             }
  481.         }, year, month, dayOfMonth);
  482.  
  483.         datePickerDialog.getDatePicker().setMinDate(System.currentTimeMillis() - 1000);
  484.  
  485.         datePickerDialog.show();
  486.     }
  487.     private boolean areAllFieldsFilled() {
  488.         return !fullNameEditText.getText().toString().isEmpty() &&
  489.                 !contactNumberEditText.getText().toString().isEmpty() &&
  490.                 !emailEditText.getText().toString().isEmpty() &&
  491.                 !reservationDateEditText.getText().toString().isEmpty() &&
  492.                 !yourGcashNameET.getText().toString().isEmpty() &&
  493.                 !yourGcashNumberET.getText().toString().isEmpty() &&
  494.                 !referenceNumberET.getText().toString().isEmpty()  &&
  495.                 selectedImageUri != null;
  496.     }
  497.  
  498.     public void retrieve (String restoId) {
  499.         TextView depositNumberTV = findViewById(R.id.gcashDepositNumberET);
  500.         TextView depositNameTV = findViewById(R.id.gcashDepositNameET);
  501.  
  502.         DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReference();
  503.         DatabaseReference restoRef = databaseReference.child("restaurants").child(restoId);
  504.  
  505.         restoRef.addListenerForSingleValueEvent(new ValueEventListener() {
  506.             @Override
  507.             public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  508.                 Log.d("BookForm", "onDataChange called");
  509.                 if (dataSnapshot.exists()) {
  510.                     String gcashNumber = dataSnapshot.child("gcashNumber").getValue(String.class);
  511.                     String gcashName = dataSnapshot.child("gcashName").getValue(String.class);
  512.  
  513.                     depositNumberTV.setText(gcashNumber);
  514.                     depositNameTV.setText(gcashName);
  515.  
  516.                 }
  517.             }
  518.  
  519.             @Override
  520.             public void onCancelled(@NonNull DatabaseError databaseError) {
  521.                 Log.e("DynamicHotel", "Failed to retrieve hotel data: " + databaseError.getMessage());
  522.             }
  523.         });
  524.     }
  525.  
  526.  
  527.  
  528.     private AlertDialog showTermsDialog() {
  529.         AlertDialog.Builder builder = new AlertDialog.Builder(this);
  530.         View customView = getLayoutInflater().inflate(R.layout.dialog_payment, null);
  531.         builder.setView(customView);
  532.  
  533.         AlertDialog alertDialog = builder.create();
  534.  
  535.         AppCompatButton understandButton = customView.findViewById(R.id.understandButton);
  536.         understandButton.setOnClickListener(new View.OnClickListener() {
  537.             @Override
  538.             public void onClick(View v) {
  539.                 alertDialog.dismiss();
  540.             }
  541.         });
  542.  
  543.         alertDialog.show();
  544.  
  545.         return alertDialog;
  546.     }
  547.  
  548.     public void goBack(View view) {
  549.         onBackPressed();
  550.     }
  551. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement