null field check

This commit is contained in:
Page Asgardius 2022-09-04 16:22:07 -07:00
parent 6c31bb15e5
commit 14e685c898
2 changed files with 5 additions and 2 deletions

View file

@ -36,7 +36,9 @@ public class AccountAdd extends AppCompatActivity {
System.out.println("Password " + password);
MyDbHelper dbHelper = new MyDbHelper(AccountAdd.this);
SQLiteDatabase db = dbHelper.getWritableDatabase();
if (db != null) {
if (alias.equals("") || endpoint.equals("") || username.equals("") || password.equals("")) {
Toast.makeText(getApplicationContext(),getResources().getString(R.string.accountadd_null), Toast.LENGTH_SHORT).show();
} else if (db != null) {
// Database Queries
try {
db.execSQL("INSERT INTO account VALUES (\""+alias+"\", \""+endpoint+"\", \""+username+"\", \""+password+"\")");

View file

@ -12,7 +12,8 @@
<string name="accountadd_username">S3 Access Key</string>
<string name="accountadd_password">S3 Secret Key</string>
<string name="accountadd_success">Account added successfully</string>
<string name="accountadd_fail">Check your account details</string>
<string name="accountadd_fail">This alias is already in use</string>
<string name="accountadd_null">All fields are required</string>
<string name="explorer_test_button">File Explorer Test</string>
<string name="video_test_button">Video Test</string>
<string name="media_conn_fail">Cannot retrieve media file</string>