title: Comparing Donor's and Recipient's blood groups
body: <p>Currently I have a blood group class that checks the blood compatibility of a donor and recipient. It shows which blood group a donor can donate to and that of which a receiver can receive from. The code is </p>
  
  <p><strong>BLOODGROUP.JAVA</strong></p>
  
  <pre><code> package com.safeguy.blooddonor.classes;
  
  /**
   * Created by Lenovo User on 6/17/2017.
   */
  
  
  public class BloodGroup {
  
      public BloodGroup(){
      }
  
      public boolean donor(String a, String b){
          boolean t = false;
          String donor = a.toUpperCase();
          String rec = b.toUpperCase();
  
          if(donor.equals("O+") &amp;&amp; rec.equals("O+")){
              t = true;
          }
          else if(donor.equals("O-")){
              t = true;
          }
          else if(donor.equals("A+") &amp;&amp; (rec.equals("A+") || rec.equals("AB+"))){
              t = true;
          }
          else if(donor.equals("A-") &amp;&amp; (rec.equals("A+") || rec.equals("AB+") || (rec.equals("A-") || (rec.equals("AB-"))))){
              t = true;
          }
          else if(donor.equals("B+") &amp;&amp; (rec.equals("AB+") || rec.equals("B+"))){
              t = true;
          }
          else if(donor.equals("B-") &amp;&amp; (rec.equals("AB+") || rec.equals("AB-") || rec.equals("B+") || (rec.equals("B-")))){
              t = true;
          }
          else if(donor.equals("AB+") &amp;&amp; (rec.equals("AB+"))){
              t = true;
          }
          else if(donor.equals("AB-") &amp;&amp; (rec.equals("AB+") || rec.equals("AB-"))){
              t = true;
          }
          return t;
      }
  
  
      public boolean recepient(String a, String b){
          boolean t = false;
          String rec = a.toUpperCase();
          String don = b.toUpperCase();
  
          if(rec.equals("AB+")){
              t = true;
          }
          else if(rec.equals("AB-") &amp;&amp; (don.equals("AB-") || don.equals("A-") || don.equals("B-") || (don.equals("O-")))){
              t = true;
          }
          else if(rec.equals("A+") &amp;&amp; (don.equals("A+") || (don.equals("A-") || don.equals("O-") || don.equals("O+")))){
              t = true;
          }
          else if(rec.equals("A-") &amp;&amp; (don.equals("A-") || (don.equals("A+")))){
              t = true;
          }
          else if(rec.equals("B+") &amp;&amp; (don.equals("B+") || (don.equals("B-") || (don.equals("O-")) || (don.equals("O+"))))){
              t = true;
          }
          else if(rec.equals("B-") &amp;&amp; (don.equals("B-") || (don.equals("O-")))){
              t = true;
          }
          else if(rec.equals("O+") &amp;&amp; (don.equals("O+")) || (don.equals("O-"))){
              t = true;
          }
          else if(rec.equals("O-") &amp;&amp; (don.equals("O-"))){
              t = true;
          }
  
          return t;
      }
  }
  </code></pre>
  
  <p>I want the application to access a host blood group and compare it with that of the Donor. The code that gets the host blood group from the Application is..</p>
  
  <p><strong>ViewActiveRequests.JAVA</strong></p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_view_lists_toolbar);
          sessionManager = new SessionManager();
  
          list = (ListView) findViewById(R.id.listView);
          personList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbarViewRequests);
          toolbar.setTitle("View Active Blood Requests");
  
          //android.support.v7.widget.Toolbar
          setSupportActionBar(toolbar);
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
          initialize();
          callProgressDialog();
          getData();
      }
  
      private void initialize() {
          Intent getUsername = getIntent();
          CURRENTUSER= getUsername.getStringExtra("USERNAME");
          LOCAL_BLOOD_GROUP = sessionManager.getUserDetails(this,"BLOODGROUP_LOGGED");
  
          filter = false;
          FilteredBloodgroup = "unfiltered";
  
  
          list.setOnItemClickListener(this);
          FilterBySpinner = (Spinner)findViewById(R.id.spFilterBy);
          FilterBySpinner.setOnItemSelectedListener(this);
  
          List&lt;String&gt; bloodCategories = new ArrayList&lt;String&gt;();
          bloodCategories.add("Filter List Here");
          bloodCategories.add("A+");
          bloodCategories.add("A-");
          bloodCategories.add("B+");
          bloodCategories.add("B-");
          bloodCategories.add("AB+");
          bloodCategories.add("AB-");
          bloodCategories.add("O+");
          bloodCategories.add("O-");
          bloodCategories.add("Unfiltered");
  
          ArrayAdapter&lt;String&gt; bloodCategoriesAdapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_spinner_item,bloodCategories);
  
          FilterBySpinner.setAdapter(bloodCategoriesAdapter);
      }
  </code></pre>
  
  <p>What I want is that the app should fetch both Donor's and recipients blood groups, check for their compatibility at bloodgroup.java class the shows if the blood is compatible or not. </p>