2011-12-08 3 views
2

내 응용 프로그램 내에 기본 프로필을 만드는 데 다음 코드가 있으며 배열 내에 사용자의 모든 성능 데이터를 보유하는 다른 클래스의 개체와 다양한 다른 기본 개체 데이터 유형. 필자는이 클래스 내에 parcelable 인터페이스를 구현하여 사용자 프로필 객체를 읽기 또는 쓰기를위한 내 응용 프로그램 내의 다양한 활동에 전달할 수 있습니까? 이 프로필 클래스뿐만 아니라 성능 클래스 내에서 parcelable 인터페이스를 구현해야합니까?다른 개체로 구성된 클래스에서 Parcelable 인터페이스 구현

public class Profile { 

private String name; 
private String email; 
private Performance Progress; 

private int seed; 
private int LastRevisionQuestion = 0; 

private int[] LastQuestionQuizLinear = {0,0,0}; 
private int[] tempScoreQuizLinear = {0,0,0}; 

private int[] LastQuestionQuizRandom = {0,0,0}; 
private int[] tempScoreQuizRandom = {0,0,0}; 

private int[] LastQuestionTimedQuizLinear = {0,0,0}; 
private int[] tempScoreTimedQuizLinear = {0,0,0}; 
private int[] tempTotalTimeTimedQuizLinear = {0,0,0}; 

private int[] LastQuestionTimedQuizRandom = {0,0,0}; 
private int[] tempScoreTimedQuizRandom = {0,0,0}; 
private int[] tempTotalTimeTimedQuizRandom = {0,0,0}; 


/** 
* Default constructor 
*/ 
public Profile(){ 
    this("ProfileName", "ProfileEmail"); 
} 

/** 
* Overloaded constructor takes user name and email address as input parameter to create a new user 
* @param name 
* @param email 
*/ 
public Profile(String name, String email){ 
    this.name = name; 
    this.email = email; 
    setProgress(new Performance()); 
} 
} 
+0

http://stackoverflow.com/questions/3513665/problem-in-implementing-parcelable-containing-other-parcelable/14146574#14146574 몇 가지 좋은 코드 예가 ​​있습니다. –

답변

1

당신은 간단한 데이터 유형 (INT, 문자열, 부울 등), parcelablesmap들 소포 수 있습니다. 그래서 예, 최선의 방법은 에도 parcelable을 구현하는 것입니다.

+1

및 일부 배열 ... –

관련 문제