title: How to access data inside my ArrayList<Parcelable>
body: <p>This is my scenario. I get data from a web service and display those data in recycler view. After that I'm planing to add those data in to local sqlite database and display those data when user open application without internet connection. I decided to use IntentService for this so I can save those data without blocking main thread.</p>
  
  <p>I'm using retrofit, GSON and RxJAVA combination to take data from REST service.</p>
  
  <pre><code>retrofit = new Retrofit.Builder()
                  .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                  .addConverterFactory(GsonConverterFactory.create())
                  .baseUrl(BASE_URL)
                  .build();
  
  public void getAllEvent(){
  
          EventService eventService = retrofit.create(EventService.class);
          Single&lt;List&lt;Event&gt;&gt; eventsAsSingle = eventService.getEvents();
  
          eventDisposableSingleObserver = eventsAsSingle
                  .subscribeOn(Schedulers.io())
                  .observeOn(AndroidSchedulers.mainThread())
                  .subscribeWith(new DisposableSingleObserver&lt;List&lt;Event&gt;&gt;() {
                      @Override
                      public void onSuccess(@NonNull List&lt;Event&gt; events) {
  
                          //eventDataList is type of ArrayList&lt;Event&gt; 
                          eventDataList.addAll(events);
                          EventListAdapter listAdapter = new EventListAdapter(MainActivity.this,eventDataList);
                          recyclerView.setAdapter(listAdapter);
                          recyclerView.addItemDecoration(new RecyclerViewDividerVertical(5));
                          recyclerView.setLayoutManager(new LinearLayoutManager(MainActivity.this));
  
                          //TODO: ADD data into SQLight
                          Intent intent = new Intent(MainActivity.this,EventCacheService.class);
                          intent.putParcelableArrayListExtra("event_data",eventDataList);
                          startService(intent);
  
                      }
  
                      @Override
                      public void onError(@NonNull Throwable e) {
                          Log.d(TAG, "on Error : " + e.getMessage());
                      }
                  });
      }
  </code></pre>
  
  <p>Here's my <code>Event</code> class.</p>
  
  <pre><code>import android.os.Parcel;
  import android.os.Parcelable;
  
  import com.google.gson.annotations.Expose;
  import com.google.gson.annotations.SerializedName;
  
  public class Event implements Parcelable {
  
      @SerializedName("id")
      @Expose
      private String id;
      @SerializedName("type")
      @Expose
      private String type;
      @SerializedName("actor")
      @Expose
      private Actor actor;
      @SerializedName("repo")
      @Expose
      private Repo repo;
      @SerializedName("payload")
      @Expose
      private Payload payload;
      @SerializedName("public")
  
      @Override
      public int describeContents() {
          return 0;
      }
  
      public Event() {
      }
  
      protected Event(Parcel in) {
          this.id = in.readString();
          this.type = in.readString();
          this.actor = in.readParcelable(Actor.class.getClassLoader());
          this.repo = in.readParcelable(Repo.class.getClassLoader());
          this.payload = in.readParcelable(Payload.class.getClassLoader());
      }
  
      @Override
      public void writeToParcel(Parcel dest, int flags) {
          dest.writeString(this.id);
          dest.writeString(this.type);
          dest.writeParcelable(this.actor, flags);
          dest.writeParcelable(this.repo, flags);
          dest.writeParcelable(this.payload, flags);
      }
  
      public String getId() {
          return id;
      }
  
      public void setId(String id) {
          this.id = id;
      }
  
      public String getType() {
          return type;
      }
  
      public void setType(String type) {
          this.type = type;
      }
  
      public Actor getActor() {
          return actor;
      }
  
      public void setActor(Actor actor) {
          this.actor = actor;
      }
  
      public Repo getRepo() {
          return repo;
      }
  
      public void setRepo(Repo repo) {
          this.repo = repo;
      }
  
      public Payload getPayload() {
          return payload;
      }
  
      public void setPayload(Payload payload) {
          this.payload = payload;
      }
  
      public static final Parcelable.Creator&lt;Event&gt; CREATOR = new Parcelable.Creator&lt;Event&gt;() {
          @Override
          public Event createFromParcel(Parcel source) {
              return new Event(source);
          }
  
          @Override
          public Event[] newArray(int size) {
              return new Event[size];
          }
      };
  
  }
  </code></pre>
  
  <p>My service class.</p>
  
  <pre><code>public class EventCacheService extends IntentService {
  
      public EventCacheService() {
          super("EventCacheService");
      }
  
      @Override
      protected void onHandleIntent(Intent intent) {
          if (intent != null) {
              ArrayList&lt;Parcelable&gt; eventData = intent.getParcelableArrayListExtra("event_data");
              System.out.println("yeee");
          }
      }
  }
  </code></pre>
  
  <p>If I set a break point on <code>System.out.println()</code> I can see that I have taken all the data from my activity to Service successfully. </p>
  
  <p><a href="https://i.stack.imgur.com/cWUXM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cWUXM.jpg" alt="enter image description here"></a> </p>
  
  <p>But I can't find a way to access those <code>Event</code> type objects. As suggested in most places I can't convert these objects in to <code>Event</code> type by simply doing. </p>
  
  <pre><code>(ArrayList&lt;Event&gt;)intent.getParcelableArrayListExtra("event_data"); 
  </code></pre>
  
  <p>I'm getting an error saying <code>Error:(20, 99) error: incompatible types: ArrayList&lt;Parcelable&gt; cannot be converted to ArrayList&lt;Event&gt;</code></p>
  
  <p>Please point out what I'm going wrong. Is there any better way to handle this ?</p>