title: null pointer exception when I refer to my custom class?
body: <p>Because my log command kicks out a "4" I am guessing it is:</p>
  
  <pre><code>word.getnewword();
  </code></pre>
  
  <p>that is returning the null pointer exception, but why?</p>
  
  <p>The aim of the code is to have a class that will hold different letters in a word for me to then animate each letter in the word separately then change the word to a random new one from a list in the class. I am using char for each letter instead of a string for the word or each letter, is that ok also?</p>
  
  <pre><code>package com.xyz.letters;
  
  import ......abreviated
  
  
  
  public class letters extends Activity {
  
  private Animals word;
  boolean gameover = false;
  private AdView adView;
  
  TextView tva;
  TextView tvb;
  TextView tvc;
  TextView tvd;
  TextView tve;
  TextView tvf;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.letters);
      Log.e("main", "xml loaded fine"); 
      tva = (TextView) findViewById(R.id.texta);
      tvb = (TextView) findViewById(R.id.textb);
      tvc = (TextView) findViewById(R.id.textc);
      tvd = (TextView) findViewById(R.id.textd);
      tve = (TextView) findViewById(R.id.texte);
      tvf = (TextView) findViewById(R.id.textf);
      Log.e("main", "textview pre-setup complete"); 
  
  
  
  
      Log.e("main", "4"); 
          word.getnewword();  
          Log.e("main", "gotword " + word.getwordchosennumber());
          setletters();
          Log.e("main", "set letters ok");
  ......etc
  </code></pre>
  
  <p>My class:-</p>
  
  <pre><code>package com.xyz.letters;
  
  import java.util.Random;
  
  import android.util.Log;
  
  
  public class Animals {
  
  private int wordchosen;
  private int length;
  private char l1;
  private char l2;
  private char l3;
  private char l4;
  private char l5;
  private char l6;
  
  
  public Animals() {
      this.wordchosen = 0;
      this.length = 3;
      this.l1 = 'a';
      this.l2 = 'b';
      this.l3 = 'c';
      this.l4 = 'a';
      this.l5 = 'b';
      this.l6 = 'c';
  
  }
  
  public void getnewword() {
      Log.e("animals", "0");
         Random ran = new Random();
          Log.e("animals", "1");
         wordchosen = ran.nextInt(2); 
          Log.e("animals", "2");
  
     switch (wordchosen) {
          case 0:
              length = 3;
              l1 = 'a';
              l2 = 'n';
              l3 = 't';
              break;
          case 1:
              length = 4;
              l1 = 'b';
              l2 = 'a';
              l3 = 'l';
              l4 = 'l';
              break;
          case 2:
              length = 3;
              l1 = 'b';
              l2 = 'a';
              l3 = 't';
              break;
  
  
          default: 
              length = 0;
              break;
      }
  }
  
  public int getwordchosennumber()
  {
      return this.wordchosen;
  }
  
  public int getlength()
  {
      return this.length;
  }
  
  public int getl1()
  {
      return this.l1;
  }
  
  public int getl2()
  {
      return this.l2;
  }
  
  public int getl3()
  {
      return this.l3;
  }
  
  public int getl4()
  {
      return this.l4;
  }
  
  public int getl5()
  {
      return this.l5;
  }
  
  public int getl6()
  {
      return this.l6;
  }
  } 
  </code></pre>