diff --git a/app/src/main/java/com/peruse/saran/amritaod/actionareas/applyodActivity.java b/app/src/main/java/com/peruse/saran/amritaod/actionareas/applyodActivity.java index 09ad585b475537891cafc70d6489554ffcd7ec89..5ab9c1d097e5033cca790f37f2574c6fb8ece603 100644 --- a/app/src/main/java/com/peruse/saran/amritaod/actionareas/applyodActivity.java +++ b/app/src/main/java/com/peruse/saran/amritaod/actionareas/applyodActivity.java @@ -59,9 +59,9 @@ public class applyodActivity extends AppCompatActivity implements AdapterView.On recievedBranch, currentdate, currentdatesend, - startperiod=null, - endperiod=null, - reason=null; + startperiod="", + endperiod="", + reason=""; private int PICK_IMAGE_REQUEST = 1, CAMERA_REQUEST = 2, startyear = calendar.get(Calendar.YEAR), @@ -178,25 +178,25 @@ public class applyodActivity extends AppCompatActivity implements AdapterView.On reason = odapplyreason.getText().toString(); startperiod = odapplystartperiod.getText().toString(); endperiod = odapplyendperiod.getText().toString(); - if(setleavetype.equals("-Select Leave Type-")){ - Toast.makeText(this,"Please Select the Leave Type", Toast.LENGTH_SHORT).show(); - } - else if(sendstartdate==null){ + if(sendstartdate==null){ Toast.makeText(this, "Please Select the Start Date", Toast.LENGTH_SHORT).show(); } else if(sendenddate==null){ Toast.makeText(this, "Please Select the End Date", Toast.LENGTH_SHORT).show(); } - else if(startperiod==null){ + else if(startperiod.equals("")){ Toast.makeText(this, "Please Select the Start Period", Toast.LENGTH_SHORT).show(); } - else if(endperiod==null){ + else if(endperiod.equals("")){ Toast.makeText(this, "Please Select the End Period", Toast.LENGTH_SHORT).show(); } - else if (reason==null){ + else if (reason.equals("")){ Toast.makeText(this, "Please give a reason", Toast.LENGTH_SHORT).show(); } - if(bitmap==null){ + else if(setleavetype.equals("-Select Leave Type-")){ + Toast.makeText(this,"Please Select the Leave Type", Toast.LENGTH_SHORT).show(); + } + else if(bitmap==null){ Toast.makeText(this, "Please Select an Image", Toast.LENGTH_SHORT).show(); } else {