title: Passing a String Array Between Java Classes Android App
body: <p>I am writing an Android app where I need to pass a string array between two classes. The string initializes fine and I can output the contents of the string fine in the one class but as I try to pass it to another class I get a Null Pointer Exception error. The following is the stripped down version of my code:</p>
  
  <p>accelerometer.java:</p>
  
  <pre><code>    public class accelerometer extends Service {
  
   public String movement[];
  
   public void onCreate() {
  
    movement = new String[1000000];
  
   }
  
   public void updatearray() {
    movement[arraypos]=getCurrentTimeString();
    //Toast.makeText(this, movement[arraypos] , Toast.LENGTH_SHORT).show(); //this correctly displays each position in the array every time it updates so I know the array is working correctly in this file
    arraypos+=1;
   }
  
   public String[] getmovement(){
    return movement;
   }
      }
  </code></pre>
  
  <p>wakeupalarm.java:</p>
  
  <pre><code>    public class wakeupalarm extends Activity {
  
   private TextView herestext_;
  
   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.wakeup);
  
    herestext_ = (TextView) findViewById(R.id.TextView01);
  
    accelerometer accelerometercall = new accelerometer();
  
    String movearray[] = accelerometercall.getmovement();
  
    herestext_.setText(movearray[2]);
    }
  
      }
  </code></pre>
  
  <p>I have a feeling I'm missing something very simple but any help would be greatly appreciated!</p>
  
  <p>Thanks,</p>
  
  <p>Scott</p>