title: Passing Custom Object List through Intent
body: <p>I am trying to make an app fetching data from JSON and displaying a location on Map using that. The Map mechanism worked fine when the List was getting loaded directly into the activity containing the Map Fragment. Now when trying to load the list in another activity and then trying to send the List via intent, I'm not able to display the data, which I suppose has something to do with the Intent.</p>
  
  <p>This is the Intent sending part</p>
  
  <pre><code>if (data != null &amp;&amp; !data.isEmpty()) {
          List&lt;AirQuality&gt; receivedData= (List&lt;AirQuality&gt;) data;
          Intent intent = new Intent(AirQualityActivity.this, MapsActivity.class);
          Bundle bundle = new Bundle();
          bundle.putSerializable("MYLIST",(Serializable) data);
          intent.putExtras(bundle);
          startActivity(intent);
      }
  </code></pre>
  
  <p>This is the Intent receiving part</p>
  
  <pre><code>    Intent i = getIntent();
      Bundle b = i.getExtras();
      List&lt;AirQuality&gt; receivedDataList = (List&lt;AirQuality&gt;) b.getSerializable("MYLIST");
  </code></pre>
  
  <p>This is the Custom Object class implementing Serializable</p>
  
  <pre><code>import java.io.Serializable;
  
  public class AirQuality implements Serializable{
      private String mId;
      private String mStation;
      private String mState;
      private String mCity;
      private String mPollutantID;
      private String mPollutantAvg;
      private String mPollutantMin;
      private String mPollutantMax;
  
      /*Default Constructor*/
  public AirQuality(String id, String station, String state, String city, String pollutantID, String pollutantAvg ,String pollutantMin, String pollutantMax) {
      mId = id;
      mStation = station;
      mState = state;
      mCity = city;
      mPollutantID = pollutantID;
      mPollutantAvg = pollutantAvg;
      mPollutantMin = pollutantMin;
      mPollutantMax = pollutantMax;
  }
  
  //Returns Item ID
  public  String getId(){
      return  mId;
  }
  
  //Returns Station Name
  public String getStation() {
      return mStation;
  }
  
  //Returns State Name
  public String getState() {
      return mState;
  }
  
  //Returns City Name
  public String getCity(){
      return mCity;
  }
  
  //Returns Pollutant ID
  public String getPollutantID() {
      return mPollutantID;
  }
  
  //Return Pollutant Average value
  public String getPollutantAvg() {
      return mPollutantAvg;
  }
  
  //Returns Pollutant Minimum value
  public String getPollutantMin(){
      return mPollutantMin;
  }
  
  //Returns Pollutant Maximum value
  public String getPollutantMax(){
      return mPollutantMax;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Any help will be appreciated. Thanks in advance.</p>