From 14e685c898bd63001bb690bbb5c2a882fedcacf2 Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Sun, 4 Sep 2022 16:22:07 -0700 Subject: [PATCH] null field check --- app/src/main/java/asgardius/page/s3manager/AccountAdd.java | 4 +++- app/src/main/res/values/strings.xml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/asgardius/page/s3manager/AccountAdd.java b/app/src/main/java/asgardius/page/s3manager/AccountAdd.java index 6ac4b1e..51cda9f 100644 --- a/app/src/main/java/asgardius/page/s3manager/AccountAdd.java +++ b/app/src/main/java/asgardius/page/s3manager/AccountAdd.java @@ -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+"\")"); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a1f6185..512bd76 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -12,7 +12,8 @@ S3 Access Key S3 Secret Key Account added successfully - Check your account details + This alias is already in use + All fields are required File Explorer Test Video Test Cannot retrieve media file