To transfer the string from the activation to the fragment, created the class class MyObject implements Parcelable. Strings are perfectly passed, but with an array, an error occurs, more correctly emphasizes the brackets readArray (). I understand that you need to write something in brackets or you may not use readArray () at all
Below all the code
public class MyObject implements Parcelable { public String paramBuk; public String[] paramImya; public MyObject(String paramBuk, String[] paramImya) { this.paramBuk = paramBuk; this.paramImya = paramImya; } private MyObject(Parcel parcel) { // Π‘ΠΎΠ·Π΄Π°Π½ΠΈΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡΠ° ΡΠ΅ΡΠ΅Π· Parcel paramBuk = parcel.readString(); paramImya = parcel.readArray(); } public int describeContents() { return 0; } public void writeToParcel(Parcel parcel, int flags) { //Π£ΠΏΠ°ΠΊΠΎΠ²ΡΠ²Π°Π½ΠΈΠ΅ ΠΎΠ±ΡΠ΅ΠΊΡΠ° Π² Parcel parcel.writeString(paramBuk); parcel.writeArray(paramImya); } public static final Parcelable.Creator<MyObject> CREATOR = new Parcelable.Creator<MyObject>() { // Π‘ΡΠ°ΡΠΈΡΠ΅ΡΠΊΠΈΠΉ ΠΌΠ΅ΡΠΎΠ΄ Ρ ΠΏΠΎΠΌΠΎΡΡΡ ΠΊΠΎΡΠΎΡΠΎΠ³ΠΎ ΡΠΎΠ·Π΄Π°Π΅ΠΌ ΠΎΠ±ΡΠ΅ΠΊΡ public MyObject createFromParcel(Parcel in) { return new MyObject(in); } public MyObject[] newArray(int size) { return new MyObject[size]; } }; }
public String paramBuk; - works great, accepts data and transmits
But with the public String [] paramImya; something is wrong, it emphasizes the brackets readArray ()