0

Serializable インターフェイスを使用して、あるアクティビティから別のアクティビティにユーザー定義データを送信しています。

これが私のコードです:

TasksheetData[] alltasks = new TasksheetData();
Intent in=new Intent(TaskSheetList.this, TaskDetails.class);
in.putExtra("TaskSheetData", alltasks);

他のアクティビティでは、次のようにこのオブジェクトにアクセスしています:

TasksheetData tData =  (TasksheetData) getIntent().getSerializableExtra("TaskSheetData");

ここに私の TasksheetData クラスがあります

@SuppressWarnings("serial")
public class TasksheetData implements Serializable {

    private int TaskID;

    private int AttendantID;
    private String  AttendentName;

    private String  ReservationID;
    private String  ResStatusCode;

    private int InspectionStartedById;
    private String  HKStatusCode;

    private int FOStatusID;
    private String  FOStatusCode;

    private int JobStatusID;
    private String  JobStatusCode;

    private int LocationID;
    private String  LocationName;

    private int RoomTypeID;
    private String  RoomType;

    private int SectionID;

    private String  GuestID;
    private String  GuestName;
    private String  VIPCode;
    private String  Pax;
    private String  ArrivalTime;
    private String  CheckInTime;
    private String  CheckOutTime;

    private String  QueueSince;

    private Trace[] arrTraces;
    private String  Specials;

    private String  ReservationComments;
    private String SupervisorComments;

    private String  HKNotes;
    private String  TaskSheetName;

    private int StandardCleaningTime;

    private int AttendantPriority;
    private String   SupervisorPriority;

    private String  TaskStartTime;
    private String  TaskEndTime;

    private String  TasksheetInstruction;

    private String localJobStatusCode;
    private Boolean isSynch;
    private String   credit;
    private String   RemainingTimeSec;

    private String   TaskTypeId;
    private String   AttendantCLTypeId, SupervisorCLTypeId;
    private String TritonLocationID;

    private String   PendingTritonJob;
    private Boolean         isDiscrepancy, InspectionStatus, IsTaskInspected;

    public int getTaskID() {
        return TaskID;
    }
    public void setTaskID(int taskID) {
        TaskID = taskID;
    }
    public int getAttendantID() {
        return AttendantID;
    }
    public void setAttendantID(int attendantID) {
        AttendantID = attendantID;
    }
    public String getAttendentName() {
        return AttendentName;
    }
    public void setAttendentName(String attendentName) {
        AttendentName = attendentName;
    }
    public String getReservationID() {
        return ReservationID;
    }
    public void setReservationID(String reservationID) {
        ReservationID = reservationID;
    }
    public String getResStatusCode() {
        return ResStatusCode;
    }
    public void setResStatusCode(String resStatusCode) {
        ResStatusCode = resStatusCode;
    }
    public int getInspectionStartedById() {
        return InspectionStartedById;
    }
    public void setInspectionStartedById(int inspectionStartedById) {
        InspectionStartedById = inspectionStartedById;
    }
    public String getHKStatusCode() {
        return HKStatusCode;
    }
    public void setHKStatusCode(String hKStatusCode) {
        HKStatusCode = hKStatusCode;
    }
    public int getFOStatusID() {
        return FOStatusID;
    }
    public void setFOStatusID(int fOStatusID) {
        FOStatusID = fOStatusID;
    }
    public String getFOStatusCode() {
        return FOStatusCode;
    }
    public void setFOStatusCode(String fOStatusCode) {
        FOStatusCode = fOStatusCode;
    }
    public int getJobStatusID() {
        return JobStatusID;
    }
    public void setJobStatusID(int jobStatusID) {
        JobStatusID = jobStatusID;
    }
    public String getJobStatusCode() {
        return JobStatusCode;
    }
    public void setJobStatusCode(String jobStatusCode) {
        JobStatusCode = jobStatusCode;
    }
    public int getLocationID() {
        return LocationID;
    }
    public void setLocationID(int locationID) {
        LocationID = locationID;
    }
    public String getLocationName() {
        return LocationName;
    }
    public void setLocationName(String locationName) {
        LocationName = locationName;
    }
    public int getRoomTypeID() {
        return RoomTypeID;
    }
    public void setRoomTypeID(int roomTypeID) {
        RoomTypeID = roomTypeID;
    }
    public String getRoomType() {
        return RoomType;
    }
    public void setRoomType(String roomType) {
        RoomType = roomType;
    }
    public int getSectionID() {
        return SectionID;
    }
    public void setSectionID(int sectionID) {
        SectionID = sectionID;
    }
    public String getGuestID() {
        return GuestID;
    }
    public void setGuestID(String guestID) {
        GuestID = guestID;
    }
    public String getGuestName() {
        return GuestName;
    }
    public void setGuestName(String guestName) {
        GuestName = guestName;
    }
    public String getVIPCode() {
        return VIPCode;
    }
    public void setVIPCode(String vIPCode) {
        VIPCode = vIPCode;
    }
    public String getPax() {
        return Pax;
    }
    public void setPax(String pax) {
        Pax = pax;
    }
    public String getArrivalTime() {
        return ArrivalTime;
    }
    public void setArrivalTime(String arrivalTime) {
        ArrivalTime = arrivalTime;
    }
    public String getCheckInTime() {
        return CheckInTime;
    }
    public void setCheckInTime(String checkInTime) {
        CheckInTime = checkInTime;
    }
    public String getCheckOutTime() {
        return CheckOutTime;
    }
    public void setCheckOutTime(String checkOutTime) {
        CheckOutTime = checkOutTime;
    }
    public String getQueueSince() {
        return QueueSince;
    }
    public void setQueueSince(String queueSince) {
        QueueSince = queueSince;
    }
    public Trace[] getArrTraces() {
        return arrTraces;
    }
    public void setArrTraces(Trace[] arrTraces) {
        this.arrTraces = arrTraces;
    }
    public String getSpecials() {
        return Specials;
    }
    public void setSpecials(String specials) {
        Specials = specials;
    }
    public String getReservationComments() {
        return ReservationComments;
    }
    public void setReservationComments(String reservationComments) {
        ReservationComments = reservationComments;
    }
    public String getSupervisorComments() {
        return SupervisorComments;
    }
    public void setSupervisorComments(String supervisorComments) {
        SupervisorComments = supervisorComments;
    }
    public String getHKNotes() {
        return HKNotes;
    }
    public void setHKNotes(String hKNotes) {
        HKNotes = hKNotes;
    }
    public String getTaskSheetName() {
        return TaskSheetName;
    }
    public void setTaskSheetName(String taskSheetName) {
        TaskSheetName = taskSheetName;
    }
    public int getStandardCleaningTime() {
        return StandardCleaningTime;
    }
    public void setStandardCleaningTime(int standardCleaningTime) {
        StandardCleaningTime = standardCleaningTime;
    }
    public int getAttendantPriority() {
        return AttendantPriority;
    }
    public void setAttendantPriority(int attendantPriority) {
        AttendantPriority = attendantPriority;
    }
    public String getSupervisorPriority() {
        return SupervisorPriority;
    }
    public void setSupervisorPriority(String supervisorPriority) {
        SupervisorPriority = supervisorPriority;
    }
    public String getTaskStartTime() {
        return TaskStartTime;
    }
    public void setTaskStartTime(String taskStartTime) {
        TaskStartTime = taskStartTime;
    }
    public String getTaskEndTime() {
        return TaskEndTime;
    }
    public void setTaskEndTime(String taskEndTime) {
        TaskEndTime = taskEndTime;
    }
    public String getTasksheetInstruction() {
        return TasksheetInstruction;
    }
    public void setTasksheetInstruction(String tasksheetInstruction) {
        TasksheetInstruction = tasksheetInstruction;
    }
    public String getLocalJobStatusCode() {
        return localJobStatusCode;
    }
    public void setLocalJobStatusCode(String localJobStatusCode) {
        this.localJobStatusCode = localJobStatusCode;
    }
    public Boolean getIsSynch() {
        return isSynch;
    }
    public void setIsSynch(Boolean isSynch) {
        this.isSynch = isSynch;
    }
    public String getCredit() {
        return credit;
    }
    public void setCredit(String credit) {
        this.credit = credit;
    }
    public String getRemainingTimeSec() {
        return RemainingTimeSec;
    }
    public void setRemainingTimeSec(String remainingTimeSec) {
        RemainingTimeSec = remainingTimeSec;
    }
    public String getTaskTypeId() {
        return TaskTypeId;
    }
    public void setTaskTypeId(String taskTypeId) {
        TaskTypeId = taskTypeId;
    }
    public String getAttendantCLTypeId() {
        return AttendantCLTypeId;
    }
    public void setAttendantCLTypeId(String attendantCLTypeId) {
        AttendantCLTypeId = attendantCLTypeId;
    }
    public String getSupervisorCLTypeId() {
        return SupervisorCLTypeId;
    }
    public void setSupervisorCLTypeId(String supervisorCLTypeId) {
        SupervisorCLTypeId = supervisorCLTypeId;
    }
    public String getTritonLocationID() {
        return TritonLocationID;
    }
    public void setTritonLocationID(String tritonLocationID) {
        TritonLocationID = tritonLocationID;
    }
    public String getPendingTritonJob() {
        return PendingTritonJob;
    }
    public void setPendingTritonJob(String pendingTritonJob) {
        PendingTritonJob = pendingTritonJob;
    }
    public Boolean getIsDiscrepancy() {
        return isDiscrepancy;
    }
    public void setIsDiscrepancy(Boolean isDiscrepancy) {
        this.isDiscrepancy = isDiscrepancy;
    }
    public Boolean getInspectionStatus() {
        return InspectionStatus;
    }
    public void setInspectionStatus(Boolean inspectionStatus) {
        InspectionStatus = inspectionStatus;
    }
    public Boolean getIsTaskInspected() {
        return IsTaskInspected;
    }
    public void setIsTaskInspected(Boolean isTaskInspected) {
        IsTaskInspected = isTaskInspected;
    }
}

しかし、データオブジェクトにキャストしようとすると、クラスキャスト例外が発生します。

これを解決するのを手伝ってください。

4

2 に答える 2

1

配列を入れて、単一のオブジェクトを期待しています。また、ArrayListwhich isを使用しますserializable

于 2012-11-12T04:26:16.070 に答える
0

あなたのTasksheetDataクラスが何であるかはわかりませんがalltasksParcelableArray代わりに your を使用する必要があります。

これをチェックアウト

TasksheetData の配列は、間違いなく 1 つの Serializable クラスのインスタンスではありません...

于 2012-11-12T04:24:13.793 に答える