다른 클래스의 배열을 참조하고 많은 재미를 얻으려고합니다. 아무도 도울 수 .. ..? 이것은 코드입니다. 나는 그것을 getName
이 문자열을 작동하고 게터을 이해하지만, 나는 게터 aff_array[] get afz()
다른 클래스의 배열
public class aff_array { String name; aff_array[] afz;
public aff_array[] getAfz() {
return afz;
}
public String getName() {
return name;
}
public static void main (String[] args) {
int z = 3; //total no of affirmations
int x = 1;
aff_array[] afz = new aff_array[z]; //dim
while (x < z) {
afz[x] = new aff_array(); // create objects for array
x = x + 1;
}
afz[1].name = "i am the best";
afz[2].name = "you are the rest";
}
이 다른 클래스와 함께 배열을 참조하는 방법을 알고하지 않기 때문에
나는 배열 값을 원하는 위치 (getName
이 작동)
public void onReceive(Context context, Intent intent)
{
setNotification(context, aff_array.class.getName());
WakeLocker.acquire(context);
Toast.makeText(context,"One shot alarm received. No more toasts will be shown.", Toast.LENGTH_SHORT).show();
WakeLocker.release();
}
감사합니다. 컴파일하지만 충돌이 발생합니다. – sunirmalya
충돌이 발생합니다. ?? 런타임 에러? 그 ArrayIndexOutOfBounds 그때 너 자신을 이해하거나 오류 정보를 말해야 할 때 –
그것은 null 인 것 같다 - 미안하다 - 나는 너를 계속 보게 될 것이다 – sunirmalya