私は2つのクラス間で文字列配列を渡す必要のあるAndroidアプリケーションを作成しています。文字列は正常に初期化され、文字列の内容を1つのクラスに出力できますが、別のクラスに渡そうとするとNull Pointer Exceptionエラーが発生します。私は、私は非常にシンプルでありながら任意の何かが欠けている感じを持っているJavaクラス間の文字列配列の受け渡しAndroid App
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]);
}
}
:
accelerometer.java:
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;
}
}
wakeupalarm.java次は私のコードのストリップダウンバージョンです。助けが大いに評価されるだろう!
おかげで、
スコット
私はばかです。助けてくれてありがとう。 – Scott