0

ProgressUpdateListener:

public interface ProgressUpdateListener  { 
        public void on_update(int downloaded_size);
}

FileDownloader

public class FileDownloader implements Parcelable {
    ProgressUpdateListener listener;

    public FileDownloader(ProgressUpdateListener listener) {
        this.listener = listener;
    }


   @Override
   public void writeToParcel(Parcel dest, int flags) {
     // how to write listener?
   }
}

My question is how to deal with the listener reference in writeToParcel..??

Umang Kothari
  • 3,674
  • 27
  • 36
Daniel
  • 861
  • 1
  • 8
  • 12
  • Interface can't be instantiated it can only be implemented, You need to implement this interface in your class. – Jitender Dev Jul 11 '14 at 10:10
  • You can let the concreate instance also implements Serializable, put the object inside a bundle, and wrote it in the Parcelable. I ma not sure if it works – Blackbelt Jul 11 '14 at 10:12

1 Answers1

-2

Interface can't be instantiated it can only be implemented, You need to implement this interface in your class

Do like this, and add un-implemented methods as well

 public class FileDownloader implements Parcelable,ProgressUpdateListener  {
Jitender Dev
  • 6,907
  • 2
  • 24
  • 35