第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

我無法將帶有一個片段的包的 ArrayList 放入另一個片段

我無法將帶有一個片段的包的 ArrayList 放入另一個片段

一只萌萌小番薯 2023-06-14 10:43:16
我想在另一個片段中使用我自己的數(shù)據(jù)類型的 ArrayList,我用一個包對其進行測試,并將列表與 putParcelableArrayList 方法放在一起,但它沒有用。任何想法為什么,或更好的建議?片段 1:Bundle arguments = new Bundle(); arguments.putParcelableArrayList("BESTAND", (ArrayList<Bestand>) palBestand);片段 2:ArrayList<Bestand> bestandsliste = (ArrayList<Bestand>) getArguments().getParcelableArrayList("BESTAND");
查看完整描述

1 回答

?
www說

TA貢獻1775條經(jīng)驗 獲得超8個贊

這是 Parcelable 類的示例


public class Student implements Parcelable{

        private String id;

        private String name;

        private String grade;


        // Constructor

        public Student(String id, String name, String grade){

            this.id = id;

            this.name = name;

            this.grade = grade;

       }

       // Getter and setter methods

       .........

       .........


       // Parcelling part

       public Student(Parcel in){

           String[] data = new String[3];


           in.readStringArray(data);

           // the order needs to be the same as in writeToParcel() method

           this.id = data[0];

           this.name = data[1];

           this.grade = data[2];

       }


       @Оverride

       public int describeContents(){

           return 0;

       }


       @Override

       public void writeToParcel(Parcel dest, int flags) {

           dest.writeStringArray(new String[] {this.id,

                                               this.name,

                                               this.grade});

       }

       public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {

           public Student createFromParcel(Parcel in) {

               return new Student(in); 

           }


           public Student[] newArray(int size) {

               return new Student[size];

           }

       };

   }


查看完整回答
反對 回復(fù) 2023-06-14
  • 1 回答
  • 0 關(guān)注
  • 148 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號