title: Android adding values of first characters of firstname,middlename and last name
body: <p>I am developing an Android app..in which user's FirstName, middlename and LastName is taken as input.. and ...the application is based on numerology.. so each letter has its own value...like following..
  A, J, S – 1
  B, K, T – 2
  C, L, U – 3
  D, M, V – 4
  E, N, W – 5
  F, O, X – 6
  G, P, Y – 7
  H, Q, Z – 8
  I, R – 9
  So when user enters his name .. the first letter of FirstName, then first Letter of middle name and first letter of Last Name has to be taken .. and the corresponding values has to be add to a single digit ... and the value has to be display on another page
  For ex: my name ROSHAN PETER .. so First Name : ROSHAN and LAst Name : PETER.. so take first letter of'ROSHAN' and 'PETER' .. so we will get two letters'R' &amp; 'P' .. I dont have middle name.. so that value will be zero. So value of R - 9 and value of P - 7 so adding that together 9 + 7 = 16 so we need to display in single digit so, we add both letters of 16 like 1+6 = 7 .. so our answer is 7 and we need to display it on another page...
  I did the code like this but the result is not showing..</p>
  
  <p>MainActvity</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
  
      }
  
      public void gReport(View V) 
      {
          EditText et1 = (EditText) findViewById (R.id.editText1);
          EditText et2 = (EditText) findViewById (R.id.editText2);
          EditText et3 = (EditText) findViewById (R.id.editText3);
          TextView tv1 = (TextView) findViewById (R.id.textView1);
          ArrayList&lt;Integer&gt; sum1;
          long sum2 =0;
          sum1 = getMissingNo(et1.getText().toString() + et2.getText().toString());
  
          String firstName = et1.getText().toString();
          String middleName = et2.getText().toString();
          String lastName = et3.getText().toString();
          char blno = firstName.charAt(0);
          char blno1 = middleName.charAt(0);
          char blno2 = lastName.charAt(0);
          sum2 = getSum(String.valueOf(blno) + String.valueOf(blno1) + String.valueOf(blno2));
  
          int itemCount =sum1.size();
          tv1.setText(String.valueOf(blno));
          Intent in = new Intent(this, FirstActivity.class);
          in.putIntegerArrayListExtra("sum1", (ArrayList&lt;Integer&gt;) sum1);
          in.putExtra("itemCount", itemCount);
          in.putExtra("name2", sum2);
          startActivity(in);
  
          //int itemCount = sum1.size();
  
  
  
  
  
  
      }
  
      private long getSum(String text) {
          // TODO Auto-generated method stub
           long sum2 = 0;
  
  
              char[] name2 = new char[text.length()];
  
                     name2 = text.toCharArray();
  
                     for(int i=0; i&lt;text.length(); i++)
                     {
                         sum2 += value2( name2[i] );
                      }
                       while (sum2&gt;9)
  
  
                     {                  
  
  
                         sum2 = findDigitSum2(sum2);
                     }
                    return sum2;
      }
  
      private long findDigitSum2(long n) {
          // TODO Auto-generated method stub
          int sum2=0;
          while (n != 0) 
          {
           sum2 += n % 10;
           n = n / 10;
          }
          return sum2;
      }
  
      private long value2(char a) {
          // TODO Auto-generated method stub
  
  
  switch(a)
              {
                 case 'A': return 1;    
                 case 'B': return 2;
                 case 'C': return 3;
                 case 'D': return 4;
                 case 'E': return 5;
                 case 'F': return 6;
                 case 'G': return 7;
                 case 'H': return 8;
                 case 'I': return 9;
                 case 'J': return 1;
                 case 'K': return 2;
                 case 'L': return 3;
                 case 'M': return 4;
                 case 'N': return 5;
                 case 'O': return 6;
                 case 'P': return 7;
                 case 'Q': return 8;
                 case 'R': return 9;
                 case 'S': return 1;          
                 case 'T': return 2;
                 case 'U': return 3;
                 case 'V': return 4;
                 case 'W': return 5;
                 case 'X': return 6;
                 case 'Y': return 7;
                 case 'Z': return 8;
                 default:  return 0;
  
              }
      }
  
      private ArrayList&lt;Integer&gt; getMissingNo(String text) {
           ArrayList&lt;Integer&gt; sum1 = new ArrayList&lt;Integer&gt;();
          // TextView tv1 = (TextView) findViewById (R.id.textView1);
              boolean[] usedNos = new boolean[9];
  
  
  
              for(int i=0; i&lt;text.length(); i++){
                  usedNos [(int) (value1(text.charAt(i))-1)] = true;
              }
  
  
  
  
              for(int i=0; i&lt;9; i++){
                  if(!usedNos[i]){
                     sum1.add(i+1);
                      //System.out.println((i+1) + " is missing");
                      //tv1.setText(String.valueOf((i+1)));
  
  
                  }
              }
  
              return sum1;
          // TODO Auto-generated method stub
  
      }
  
  
  
      private long value1(char a) {
          // TODO Auto-generated method stub
  
  
  switch(a)
              {
                 case 'A': return 1;    
                 case 'B': return 2;
                 case 'C': return 3;
                 case 'D': return 4;
                 case 'E': return 5;
                 case 'F': return 6;
                 case 'G': return 7;
                 case 'H': return 8;
                 case 'I': return 9;
                 case 'J': return 1;
                 case 'K': return 2;
                 case 'L': return 3;
                 case 'M': return 4;
                 case 'N': return 5;
                 case 'O': return 6;
                 case 'P': return 7;
                 case 'Q': return 8;
                 case 'R': return 9;
                 case 'S': return 1;          
                 case 'T': return 2;
                 case 'U': return 3;
                 case 'V': return 4;
                 case 'W': return 5;
                 case 'X': return 6;
                 case 'Y': return 7;
                 case 'Z': return 8;
                 default:  return 0;
  
              }
      }
  </code></pre>
  
  <p>FirstActivity</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.firstactivity_xm);
  
          TextView tv1 = (TextView) findViewById (R.id.textView1);
  
  
  
          ArrayList&lt;Integer&gt; list = getIntent().getIntegerArrayListExtra("sum1");
          tv1.setText("");
          for (int j = 0; j &lt; list.size(); j++){
             tv1.append("KarmicLesson " + list.get(j) + "\n");
  
  
          }
  
          TextView tv3 = (TextView) findViewById (R.id.textView3);
          tv3.setText(getIntent().getStringExtra("name2"));
  
  
  }
  </code></pre>