2017-02-26 1 views
-1


내가 다음 코드 활동에 BluetoothSocket을 전달하기 위해 노력하고있어 마샬링 할 수 없습니다 :
소포 : 값 android.bluetooth.BluetoothSocket에게

Intent intent = new Intent(getActivity(), ChatActivity.class); 
Bundle bundle = new Bundle(); 
ArrayList array = new ArrayList<BluetoothSocket>(); 
array.add(connectToDevice.getMmSocket()); 
bundle.putParcelableArrayList("Array", array); 
startActivity(intent, bundle); 

그러나이 나는 활동에서 그것을 얻을하려고 할 때 나는 다음과 같은 코드로 시작하려는 :

java.lang.RuntimeException: Parcel: unable to marshal value [email protected]` 
:

Bundle bundle = getIntent().getExtras(); 
Parcelable[] parceble = bundle.getParcelableArray("Array"); 
ArrayList<BluetoothSocket> array = new ArrayList<>(parceble.length); 
BluetoothSocket socket = array.get(0); 

나는이 오류

제발 도와주세요. 미리 감사드립니다.

+0

이 클래스를 Intent를 통해 전달할 수 없습니다. 봉사 활동을하고 활동 속으로 묶으십시오. – Selvin

+0

@Selvin \t 어떻게해야합니까? 미리 양해 해 주셔서 감사합니다 –

답변

-1

BluetoothSocket 클래스가 Parcelable 인터페이스를 구현하도록하십시오.

+0

클래스가 구분 가능한 인터페이스를 구현해야하는 값을 마샬링 할 수 있도록 이미 "닫기 가능" –

+0

을 구현했습니다 – Mohamed

+0

내 액티비티에 다른 방법을 전달하지 않습니까? –

관련 문제