2015-01-04 3 views
1
 final RecipientEditTextView emailRetv = 
     (RecipientEditTextView) findViewById(R.id.email_retv); 
     emailRetv.setTokenizer(new Rfc822Tokenizer()); 
     emailRetv.setAdapter(new BaseRecipientAdapter(this)); 
     DrawableRecipientChips[] chips = phoneRetv.getSortedRecipients(); 

인 텐트를 통해 다른 활동으로 DrawableRecipientChips [] 칩을 보내야합니다. 제발 어떻게 가죠?. 당신은 당신이 다른 하나의 Activity에서 통과해야하는 복잡한 객체가있는 경우사용자 정의 배열 데이터를 의도를 통해 다른 활동으로 전달

DrawableRecipientChips [] 칩이 libary

+1

'DrawRecipientChips' 데이터 유형에 대해 알려줘야합니다. –

+0

@TedHopp 방금 libary에 링크를 게시했습니다. –

+0

'DrawableRecipientChips'는 인터페이스가 아니며 클래스이기 때문에 실제 배열 요소는 거의 모든 것이 될 수 있습니다. 나는 그들이 무엇인지 알지 못하게 (또는 'Serializable'또는 'Parcelable'을 구현하지 않는 한) 객체를 다른 액티비티로 보낼 수 있다고 생각하지 않는다. –

답변

0

에서, 당신은 Intent에 넣어 필요가 없습니다. 당신은 다음과 같이 public static 변수에 넣어 수 있습니다

ActivityA에 :

public static DrawableRecipientChips[] chips; 

ActivityB.onCreate()에서 :

// Get reference to the chips array from the previous Activity 
chips = ActivityA.chips; 

이 완벽한 해결책이 아니다 안드로이드 프로세스를 죽이면 때문에 사용자가 앱으로 돌아 오면 public static 변수가 null이됩니다. 하지만이 경우에 대비하여 테스트하고 처음부터 앱을 다시 시작할 수 있습니다.

관련 문제