Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //nothing changed here
- package com.example.mariakovaleva.dortmundtourguide;
- import android.os.Parcel;
- import android.os.Parcelable;
- import android.renderscript.Sampler;
- import java.util.ArrayList;
- public class Place implements Parcelable {
- private static final int NO_IMAGE_PROVIDED = -1;
- private int mImageResourceId = NO_IMAGE_PROVIDED;
- private int mTitleTextId;
- private int mContentTextId;
- private ArrayList<Place> place1 = new ArrayList<>();
- private ArrayList<Place> place2 = new ArrayList<>();
- private ArrayList<Place> place3 = new ArrayList<>();
- public Place(int imageResourceId, int titleTextId, int contentTextId) {
- mImageResourceId = imageResourceId;
- mTitleTextId = titleTextId;
- mContentTextId = contentTextId;
- }
- public Place(int titleTextId, int contentTextId) {
- mTitleTextId = titleTextId;
- mContentTextId = contentTextId;
- }
- public Place (Parcel in) {
- super();
- readFromParcel(in);
- }
- public static final Parcelable.Creator<ArrayList<ArrayList<Place>>> CREATOR = new Parcelable.Creator<ArrayList<ArrayList<Place>>>() {
- @Override
- public ArrayList<ArrayList<Place>> createFromParcel(Parcel in) {
- //cannot resolve constructor
- return new ArrayList<ArrayList<Place>>(in);
- }
- @Override
- //attemting to use incompatible return type
- public ArrayList<ArrayList<Place>> newArray(int size) {
- return newArray[size];
- }
- };
- public void readFromParcel(Parcel in) {
- place1 = in.readArrayList(ClassLoader.getSystemClassLoader());
- place2 = in.readArrayList(ClassLoader.getSystemClassLoader());
- place3 = in.readArrayList(ClassLoader.getSystemClassLoader());
- }
- @Override
- public int describeContents() {
- return 0;
- }
- @Override
- public void writeToParcel(Parcel dest, int flags) {
- dest.writeTypedList(place1);
- dest.writeTypedList(place2);
- dest.writeTypedList(place3);
- }
- public int getImageResourceId() {
- return mImageResourceId;
- }
- public int getTitleTextId() {
- return mTitleTextId;
- }
- public int getContentTextId() {
- return mContentTextId;
- }
- public boolean hasImage() {
- return mImageResourceId != NO_IMAGE_PROVIDED;
- }
- }
Add Comment
Please, Sign In to add comment