약간의 소스 코드를 컴파일하는 데 문제가 있습니다. "표현식 유형이 배열이어야합니다 형식이지만 TextView로 해결됨 "Google과 StackOverflow에서이 문제를 조사하려고 했으므로 SO는 응답이없는 결과 하나만 반환합니다."표현식의 유형은 배열 유형이어야하지만 TextView로 해석됩니다."
누군가 올바른 방향으로 나를 가리키게하거나이 문제를 어떻게 해결할 수 있는지 예를 들려 줄 수 있습니까?
매우 감사드립니다. - 팀
나는 다음과 같은 두 줄에이 오류의 두 인스턴스가 있습니다
beamMsg[i].setText(new String(msg[i].getRecords()[1].getPayload()));
beamMsg2[i].setText(new String(msg[i].getRecords()[1].getPayload()));
자료 제공 :
void processIntent(Intent intent) {
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(
NfcAdapter.EXTRA_NDEF_MESSAGES);
// only one message sent during the beam
NdefMessage[] msg = new NdefMessage[rawMsgs.length];
for (int i = 0; i < msg.length; i++) {
msg[i] = (NdefMessage) rawMsgs[i];
// record 0 contains the MIME type, record 1 is the AAR, if present
beamMsg[i].setText(new String(msg[i].getRecords()[1].getPayload()));
beamMsg2[i].setText(new String(msg[i].getRecords()[1].getPayload()));
}}
beamMsg [i] .setText (new String (msg [i] .getRecords() [1] .getPayload())); 여기서 getRecrods()는 함수이고 getRecaords() [1]를가집니다. getRecords (1) – Raghunandan
와 같은 함수에 매개 변수를 전달해야합니다. 제안 된 메소드 사용 : beamMsg2 [i] .setText (new String (msg [i] .getRecords (1) .getPayload())) 이미 경험 한 두 가지 새로운 오류 : NdefMessage 형식의 getRecords() 메서드는 인수 (int) –
에 해당되지 않습니다. 해당 beamMsg [i]는 실제로 TextView입니까? 그렇다면 캐스팅하고 .setText를 호출하십시오 ... – kosa