Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;

import android.widget.Toast;

public class Main {
    public static boolean isValidSignUp(String username, String password, String confirmPassword,
            Context thisActivtiy) {
        //One of the field is left blank
        if (username.equals("") || password.equals("") || confirmPassword.equals("")) {
            Toast.makeText(thisActivtiy, "Please fill in all fields.", Toast.LENGTH_SHORT).show();
            return false;
        }

        //The info is not of the right format
        //Need to finish this later
        else if (false) {
            Toast.makeText(thisActivtiy, "Please fill in all fields.", Toast.LENGTH_SHORT).show();
            return false;
        }

        //The passwords entered do not match
        else if (!password.equals(confirmPassword)) {
            Toast.makeText(thisActivtiy, "The passwords you entered do not match.", Toast.LENGTH_SHORT).show();
            return false;
        }

        else
            return true;
    }
}