Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to extend android class which implements Parcelable interface?
    primarykey
    data
    text
    <p>First of all i have check <a href="https://stackoverflow.com/questions/10841449/extending-a-class-that-implements-parcelable">this answer</a>.</p> <p>What i am trying to do is extending <code>Location</code> class calling it <code>LocationPlus</code> which has some member variables. functionality i am trying to achieve is pass the object of <code>LocationPlus</code> class from one activity to another.</p> <p>Here is my <code>CREATOR</code> </p> <pre><code>public static final Parcelable.Creator&lt;LocationPlus&gt; CREATOR = new Parcelable.Creator&lt;LocationPlus&gt;() { @Override public LocationPlus createFromParcel(Parcel source) { return new LocationPlus(source); } @Override public LocationPlus[] newArray(int size) { return new LocationPlus[size]; } }; </code></pre> <p>problem i am facing is this error</p> <pre><code>Implicit super constructor Location() is undefined. Must explicitly invoke another constructor </code></pre> <p>when trying to write constructor</p> <pre><code>public LocationPlus(Parcel in) { </code></pre> <p>Someone in comment ask me to post LocationPlus class so here it is</p> <pre><code>public class LocationPlus extends Location{ private int mBattery = -1; public LocationPlus(String locationName) { super(locationName); } public LocationPlus(Location location) { super(location); } public int getmBattery() { return mBattery; } public void setmBattery(int mBattery) { this.mBattery = mBattery; } @Override public int describeContents() { return 0; } public static final Parcelable.Creator&lt;LocationPlus&gt; CREATOR = new Parcelable.Creator&lt;LocationPlus&gt;() { @Override public LocationPlus createFromParcel(Parcel source) { return new LocationPlus(source); } @Override public LocationPlus[] newArray(int size) { return new LocationPlus[size]; } }; @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeInt(mBattery); } public LocationPlus(Parcel in) { mBattery =in.readInt(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload